View previous topic :: View next topic
|
Author |
Message |
Raj Ponnuchamy
New User
Joined: 09 Sep 2009 Posts: 9 Location: Chennai
|
|
|
|
Hi,
I have two input files Input 1 and Input 2.Both are FB files.
Input 1 contains only date field. The length of the field is S9(07) COMP-3. The length of Input 1 file is 4.
Input 2 file contains many records. The length of the file is 857.
I need to insert the date field from Input 1 into the input 2 file at the position 32. The length of the target variable in the input 2 file is also S9(07) COMP-3.
Please let me know how i can achieve this through SORT.
Thanks |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Please specify which sort product is in use at your site as the solution may vary by product.
What happens to any data that already exists in the target position in file 2.
How many records are there in file 1. If more than one, what are the rules for insertion into file 2. |
|
Back to top |
|
|
Raj Ponnuchamy
New User
Joined: 09 Sep 2009 Posts: 9 Location: Chennai
|
|
|
|
Hi,
The product used is SYNCSORT Z/OS UTIL V1R2.
The data already present in file2 should be replaced with the data from file 1.
There will be only one record in the file 1. This record needs to be inserted in the file 2 for all the records at the position 32. There is no rule for this insertion. All the record in file2 should be updated with the data from file 1
Thanks |
|
Back to top |
|
|
rockish
Active User
Joined: 05 Jun 2009 Posts: 185 Location: Planet Earth
|
|
|
|
Couple of things..
I really wonder if anybody will give you a clarification on SYNCSORT int his board.. This is exclusive for DFSORT related products..
Next thing is, you still were not clear about what happens to the data that already exists at 32nd position !!! Should they be moved to the right or replaced with the four bytes from file1 ??
The following JCL's will work with DFSORT ICETOOL:
Case 1:
Moving the data after 32nd position to the right
Code: |
//ICETOOL0 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
//IN2 DD *
//T1 DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//OUTPUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
SPLICE FROM(T1) TO(OUTPUT) USING(CTL3) ON(862,1,CH) WITH(1,31) -
WITH(36,826) WITHALL KEEPNODUPS
//CTL1CNTL DD *
OUTFIL FNAMES=T1,OUTREC=(32:1,4,862:C'0')
//CTL2CNTL DD *
OUTFIL FNAMES=T1,OUTREC=(1:1,31,36:32,826,862:C'0')
//CTL3CNTL DD *
OUTFIL FNAMES=OUTPUT,BUILD=(1,861) |
Case 2:
Replacing the data in 32-35 position
Code: |
//ICETOOL0 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
//IN2 DD *
//T1 DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//OUTPUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
COPY FROM(IN2) USING(CTL2)
SPLICE FROM(T1) TO(OUTPUT) USING(CTL3) ON(862,1,CH) WITH(1,857) -
WITHALL KEEPNODUPS
//CTL1CNTL DD *
OUTFIL FNAMES=T1,OUTREC=(32:1,4,858:C'0')
//CTL2CNTL DD *
OUTFIL FNAMES=T1,OUTREC=(1:1,857,858:C'0')
//CTL3CNTL DD *
OUTFIL FNAMES=OUTPUT,BUILD=(1,857) |
Of course, Frank/Kolusu may suggest a better piece of code with DFSORT/ICETOOL.. |
|
Back to top |
|
|
Raj Ponnuchamy
New User
Joined: 09 Sep 2009 Posts: 9 Location: Chennai
|
|
|
|
Hi,
Thanks for the update.
As for the question
"Next thing is, you still were not clear about what happens to the data that already exists at 32nd position !!! Should they be moved to the right or replaced with the four bytes from file1 ?? "
The data already existing in 32 - 35 position in file 2 should be replaced with the four bytes data from file 1.
Is it possible to achieve this using SORT instead of ICETOOL ?
Thanks, |
|
Back to top |
|
|
rockish
Active User
Joined: 05 Jun 2009 Posts: 185 Location: Planet Earth
|
|
|
|
I never handled two files using SORT so far !!!!! (Unless its a MERGE functionality)
If you are still particular about the usage of SORT, you might need to pass the four bytes as a symbolic variable rather than a separate file..
Somebody pls correct me if SORT can handle multiple input files !! |
|
Back to top |
|
|
rockish
Active User
Joined: 05 Jun 2009 Posts: 185 Location: Planet Earth
|
|
|
|
If you are okay with using symbolic variables, following code will help,
Code: |
//SORT000 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
MYPARM,X'F0F0F0F0'
//SORTIN DD DSN=<INPUT>,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC OVERLAY=(32:MYPARM) |
|
|
Back to top |
|
|
Raj Ponnuchamy
New User
Joined: 09 Sep 2009 Posts: 9 Location: Chennai
|
|
|
|
Hi,
Actually this sort job will be running daily and the value in the file1 will be changing daily. So it would be better if the values are obtained from file1 instead of hard coding the value directly in the sort card.
Thanks |
|
Back to top |
|
|
rockish
Active User
Joined: 05 Jun 2009 Posts: 185 Location: Planet Earth
|
|
|
|
I really wonder if you tried any of the JCL's I posted or simply raising questions..
Tell me why you want to use SORT and not XXXXTOOL. I have given you the JCL to get your requirement done using ICETOOL. SyncSort has its equivalent in the name of SYNCTOOL which I think also has an alias ICETOOL. I would suggest you to give atleast few minutes of YOUR effort in getting your requirement done.
I would like to quote the words of EXPAT from a different post,
Quote: |
Please note DO NOT just ask for code without showing your own attempts. This is a HELP forum, not a do it for me forum. |
|
|
Back to top |
|
|
Raj Ponnuchamy
New User
Joined: 09 Sep 2009 Posts: 9 Location: Chennai
|
|
|
|
Hi,
I was told that i should not use ICETOOL for this task in my concern. I dont know the reason for this.
Thanks for the help. I will try to achieve this by Sort. |
|
Back to top |
|
|
rockish
Active User
Joined: 05 Jun 2009 Posts: 185 Location: Planet Earth
|
|
|
|
Cool, do share the JCL with me once you are done. As am really curious to know how SORT can handle two files !! |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
rockish wrote: |
I never handled two files using SORT so far !!!!! (Unless its a MERGE functionality) |
rockish,
I am not sure which product you meant here by 'SORT'. But AFAIK a SyncSort JOIN application can have two input files.
Raj Ponnuchamy,
You can slightly modify the solution posted above like this to make it work for your requirement. This is untested. Give it a try. Good luck
Code: |
//SORT001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN= Date-file (FB/LRECL=4)
//SORTOUT DD DSN=&&T1,DISP=(,PASS)
//SYSIN DD *
SORT FIELDS=COPY
OUTREC BUILD=(C'DATE-X,''',1,4,C'''',80:X)
//SORT002 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&T1,DISP=(OLD,PASS)
//SORTIN DD DSN= Input-file (FB/LRECL=857)
//SORTOUT DD DSN= Output-file (FB/LRECL=857)
//SYSIN DD *
INREC OVERLAY=(32:DATE-X)
SORT FIELDS=COPY |
|
|
Back to top |
|
|
rockish
Active User
Joined: 05 Jun 2009 Posts: 185 Location: Planet Earth
|
|
|
|
Arun,
I think that may work with most of the SORT products
I have actually never used SYMNAMES that way !!!! Anyway, I learnt one more stuff today
Thanks for sharing.. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
rockish wrote: |
Arun,
I think that may work with most of the SORT products |
What??? |
|
Back to top |
|
|
rockish
Active User
Joined: 05 Jun 2009 Posts: 185 Location: Planet Earth
|
|
|
|
OMG.. u mistook wat i said.. i stressed on something else
Quote: |
I think that may work with most of the SORT products |
All I meant to say was, your solution will work with other products too !!!! |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Sorry for the confusion. Actually I thought u were saying "SyncSort JOIN will work with most of the sort products" |
|
Back to top |
|
|
Raj Ponnuchamy
New User
Joined: 09 Sep 2009 Posts: 9 Location: Chennai
|
|
|
|
Arun,
I have tested the sort code you provided and it worked as per my requirement. Thanks for the help. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
You're welcome. |
|
Back to top |
|
|
|