|
View previous topic :: View next topic
|
| Author |
Message |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
Hello,
I have File1 as below of 10 bytes -
| Code: |
1234567890
0987654321
6789012345
|
And File2 as below of 20 bytes -
| Code: |
ABCDE12345FGHIK67890
QWERT47859NHGTY45125
KJHGT25403YTBNO58021
|
I want to write a SORT card that will copy the 10 bytes of File1 to File2(starting 21st position)
So after sort execution, my File2 must be as below of 30 bytes -
| Code: |
----+----1----+----2----+----3
ABCDE12345FGHIK678901234567890
QWERT47859NHGTY451250987654321
KJHGT25403YTBNO580216789012345
|
How to get this done !
Thanks a lot ! |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You have a simple positional match? Record one on file one goes with record one on file two, etc?
Can you run this and post the sysout so we can see what product level you have, please?
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DUMMY
//SYSIN DD *
OPTION COPY
/* |
|
|
| Back to top |
|
 |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
Hello, There is'nt any positional match.
SYSOUT -->
| Code: |
1ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE751I 0 C5-K76982 C6-K90026 C7-K58148 C8-K67572 E9-K60824 C9-BASE E5-K76585 E7-K70685
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AND MORE
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 06:39 ON THU SEP 20, 2012 -
0 OPTION COPY 00110000
ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1
ICE751I 0 C5-K76982 C6-K90026 C7-K58148 C8-K67572 E9-K60824 C9-BASE E5-K76585 E7-K70685
ICE142I 0 SYSOUS NOT FOUND - SYSOUT USED
ICE193I 0 ICEAM1 INVOCATION ENVIRONMENT IN EFFECT - ICEAM1 ENVIRONMENT SELECTED
ICE252I 1 PARMLIB OPTIONS WERE MERGED WITH INSTALLATION MODULE DEFAULTS
ICE088I 0 MXA0270A.S1 . , INPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE093I 0 MAIN STORAGE = (MAX,10485760,10472542)
ICE156I 0 MAIN STORAGE ABOVE 16MB = (10352094,10352094)
ICE127I 0 OPTIONS: OVFLO=RC4 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC4 ,VLSCMP=N,SZERO=Y,RESET=Y,VSAMEMT=Y,DYNSPC=192
ICE128I 0 OPTIONS: SIZE=10485760,MAXLIM=2097152,MINLIM=450560,EQUALS=N,LIST=Y,ERET=ABEND,MSGDDN=SYSOUT
ICE129I 0 OPTIONS: VIO=Y,RESDNT=NONE,SMF=FULL ,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=N,DYNALOC=N ,ABCODE=016
ICE130I 0 OPTIONS: RESALL=12288,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT=N,COBEXIT=COB2
ICE131I 0 OPTIONS: TMAXLIM=10485760,ARESALL=0,ARESINV=0,OVERRGN=65536,CINV=Y,CFW=N,DSA=0
ICE132I 0 OPTIONS: VLSHRT=N,ZDPRINT=Y,IEXIT=N,TEXIT=N,LISTX=N,EFS=NONE ,EXITCK=W,PARMDDN=DFSPARM ,FSZEST=N
ICE133I 0 OPTIONS: HIPRMAX=OPTIMAL,DSPSIZE=128 ,ODMAXBF=0,SOLRF=Y,VLLONG=N,VSAMIO=N,MOSIZE=MAX
ICE235I 0 OPTIONS: NULLOUT=RC0
ICE236I 0 OPTIONS: DYNAPCT=10 ,MOWRK=Y
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTOUT
ICE084I 0 BSAM ACCESS METHOD USED FOR SORTIN
ICE751I 1 EF-BASE F0-K66717 E8-K70685
ICE090I 0 OUTPUT LRECL = 80, BLKSIZE = 80, TYPE = FB
ICE055I 0 INSERT 0, DELETE 0
ICE054I 0 RECORDS - IN: 1, OUT: 1
ICE052I 0 END OF DFSORT
|
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
OK, you have JOINKEYS from the ICE201I message value of H.
I can't see a key. So with no key an no "positional match" how the heck do you know which record goes with which?
EDIT: I've edited your subject to make it a little clearer. |
|
| Back to top |
|
 |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
It's one to one mapping.
1st record from File1 is added to 21st postion of 1st record in File2,
2nd record from File1 is added to 21st postion of 2nd record in File2, and so on ... |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
Aslam,
positional match means:
record 1 of file 1 goes with record 1 of file 2
record 2 of file 1 goes with record 2 of file 2
and so on. |
|
| Back to top |
|
 |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
| I aplogize for my lack of understanding... Thanks dbzTHEdinosauer for clearing that. |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
no problem.
the SORTTRCK PDF show how to do it,
and the verbiage there is Join fields from two files record-by-record |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I've just "hacked" this from another solution. Not tested, but at least close.
You use JOINKEYS with JNFnCNTL files. In the JNFnCNTLs you add a sequence number to the end of each record (I'm assuming they are fixed-length). Then you do the JOINKEYS on the sequence numbers. The REFORMAT sets up your output record, which needs no further changing, as the sequence numbers need not be included on it.
The SORTED and NOSEQCK are to save the files being sorted as they are already "in order" on the sequence numbers.
| Code: |
OPTION COPY
JOINKEYS F1=INA,FIELDS=(11,7,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(21,7,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F2:1,20,F1:1,10)
//JNF1CNTL DD *
OPTION COPY
INREC OVERLAY=(11:SEQNUM,7,ZD)
//JNF2CNTL DD *
OPTION COPY
INREC OVERLAY=(21:SEQNUM,7,ZD) |
|
|
| Back to top |
|
 |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
Thanks Bill, I have tried above SORT tip and that works as long as the a new sortout file is created satisfying my requirement. But I do not want a new file to be created, but the File2 to be updated with 10 bytes records from File1 at position (21,10)
Any help ? |
|
| Back to top |
|
 |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
My JCL -->
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD DSN=TEST.ASLAM.FILE1,DISP=SHR
//INB DD DSN=TEST.ASLAM.FILE2,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(11,7,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(21,7,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F2:1,20,F2:1,10)
/*
//JNF1CNTL DD *
OPTION COPY
INREC OVERLAY=(11:SEQNUM,7,ZD)
//JNF2CNTL DD *
OPTION COPY
INREC OVERLAY=(21:SEQNUM,7,ZD)
|
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Generally it is not a good idea to do that. You "loose" your original file that way.
What are you actually trying to do through this process? |
|
| Back to top |
|
 |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
| Just want to know if that is possible,update File2 rather than create a new output file ? We are just trying to map the records that we received in File1 with the records in File2. Its all a business requirement that we are trying to accompolish ! |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, I can't see the problem with using a new file and just "pretending" it is the original. That's the way it is usually done, just without the pretence.
If you want to scramble your file, first make sure you back it up. Stick the file 2 dataset name on SORTOUT and let it rip. Any problems you cause are yours and your organisation's/client's. If you look in the DFSORT manual or search here you'll find the advice is to not do this.
I can see no good reason to do this from what you have said. |
|
| Back to top |
|
 |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
| Thanks Bill. I really appreciate for helping me in this. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| techslam wrote: |
Thanks Bill, I have tried above SORT tip and that works as long as the a new sortout file is created satisfying my requirement. But I do not want a new file to be created, but the File2 to be updated with 10 bytes records from File1 at position (21,10)
Any help ? |
techslam,
For a copy application, you should NOT use the same data set for SORTIN and SORTOUT. For copy, SORTIN reads and SORTOUT writes are done concurrently, so the writes can overlay what you're trying to read. It may work, but it may also fail or give you incorrect output.
For a sort application, you can use the same data set for SORTIN and SORTOUT. For sort, all of the SORTIN records are read before the SORTOUT writes are started, so the writes cannot overlay what you're trying to read. However, we call this a "suicide sort" because if the sort gets some kind of error before the output is complete, you may have partially overlaid the input data set making it unusable. So you should only use the same data set for SORTIN and SORTOUT if you can recover from having the SORTIN data set be unusable (for example, you have a backup of the SORTIN data set, or it's a temporary data set that you can recreate). |
|
| Back to top |
|
 |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
| Thanks a lot skolusu. this explanation to the client did work..... requiremnt changed to crate new output file. thanks everyone....... |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|