View previous topic :: View next topic
|
Author |
Message |
memo
New User
Joined: 16 Nov 2021 Posts: 2 Location: Romania
|
|
|
|
Hi! New to JCL.
I have an existing file(AAA) which contains 2 records: two file names (BBB, CCC)
File AAA:
Code: |
=COLS> 3----+----4----+----5----+----6----+----7----+----8----+----9----+----0-
****** ***************************** Top of Data ******************************
000001 0000000420211018BBB
000002 0000000420211018CCC
****** **************************** Bottom of Data **************************** |
File BBB:
Code: |
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001 2211001000000011349
000002 2212001000000021349
000003 2213001000000031349
000004 2214001000000041349
****** **************************** Bottom of Data **************************** |
File CCC:
Code: |
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001 2211001000000011111
000002 2212001000000022222
000003 2213001000000033333
000004 2214001000000044444
****** **************************** Bottom of Data **************************** |
Files BBB and CCC are of the same record length.
I would like to replace the data in file BBB (position 13:24) with data from file CCC (position 13:24). Records are identified with key(position 6:12).
I really would appreaciate your help. Thank you! |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
You cannot do this with JCL.
Consider using your SORT product which should be able to do this in two stages. The first stage can use file AAA to generate the JCL for the second stage - a step to execute the SORT that will do the replacement in file BBB from file CCC using JOINKEYS if matching records on key postion.
If new to the SORT product, it might be better to address the second stage first.
Garry. |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 730 Location: Denmark
|
|
|
|
or a program, REXX springs to mind. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2135 Location: USA
|
|
|
|
First: there are no such things as "files" on mainframes.
Second: no dataset with DSN=BBB or similar may exist on mainframe.
So, the task can't be done.
Finally: this question has no relation to neither JCL, nor VSAM |
|
Back to top |
|
|
memo
New User
Joined: 16 Nov 2021 Posts: 2 Location: Romania
|
|
|
|
Garry Carroll wrote: |
You cannot do this with JCL.
Consider using your SORT product which should be able to do this in two stages. The first stage can use file AAA to generate the JCL for the second stage - a step to execute the SORT that will do the replacement in file BBB from file CCC using JOINKEYS if matching records on key postion.
If new to the SORT product, it might be better to address the second stage first.
Garry. |
Thank you for your help Gary. Much appreciated! |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2135 Location: USA
|
|
|
|
Part 1 of your problem seems to be unneeded. Must be re-viewed by software designer(s)
Part 2 can be done by SORT utility, it is not JCL, absolutely!!!
Code: |
//REPLACE EXEC PGM=SORT
// . . . standard SORT utility DD statements here . . . .
// . . . can be different for DFSORT/SYNCSORT, or customized by IT department
//DATABBB DD *
2211001000000011349
2212001000000021349
2213001000000031349
2214001000000041349
//*
//DATACCC DD *
2211001000000011111
2212001000000022222
2213001000000033333
2214001000000044444
//*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS F1=DATABBB,FIELDS=(6,7,A),SORTED
JOINKEYS F2=DATACCC,FIELDS=(6,7,A),SORTED
JOIN UNPAIRED,F1 ignore non-matching F2 records
REFORMAT FIELDS=(F1:1,80,F2:1,80,?)
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(161,1,CH,EQ,C'B'), check for matching keys
BUILD=(81,24, =1-24 from F2, key+data
25,56)), =25-80 from F1, rest of data
IFTHEN=(WHEN=NONE, for non-matching keys
BUILD=(1,80)) =1-80 from F1
END
//*
|
|
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
What is the significance of AAA Data set in all this ? Second it’s a simple ask of joining two datasets and replacing values of one dataset by another data set. If you do a SEARCH JOINKEYS then you will find many posts addressing the same problem.
Moved to DFSORT section.
E.g ibmmainframes.com/about62319.html |
|
Back to top |
|
|
|