|
View previous topic :: View next topic
|
| Author |
Message |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
I have 5 input files, say
INPUT.FILE1
INPUT.FILE2
INPUT.FILE3
INPUT.FILE4
INPUT.FILE5
each of LRECL=80
Now i want to create a single output file say MASTER.OUTPUT file which should contain records from each of the above five input files with an additional 9 bytes hard coded
value added at the end of each record resulting in LRECL=89 for MASTER.OUTPUT.
hard coded value will be different for each of the input files. that is,
for all the recordsin INPUT.FILE1 the 9 byte hardcoded value will be 111111111,
for all the recordsin INPUT.FILE2 the 9 byte hardcoded value will be 222222222,
for all the recordsin INPUT.FILE3 the 9 byte hardcoded value will be 333333333,
for all the recordsin INPUT.FILE4 the 9 byte hardcoded value will be 444444444,
for all the recordsin INPUT.FILE5 the 9 byte hardcoded value will be 555555555
So if each input files have 100 records, then my output file will have 500 records.
How do I get this done using DFSORT.
I have tried few things but unable to get what I want. Any help will be highly appreciated. |
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| Code: |
//STEP0200 EXEC PGM=ICETOOL
//SYSOUT DD SYSOUT=*
//SIN1 DD *
THIS IS FILE1
//SIN2 DD *
THIS IS FILE2
//SIN3 DD *
THIS IS FILE3
//SIN4 DD *
THIS IS FILE4
//SIN5 DD *
THIS IS FILE5
//SOUT DD DISP=(MOD,CATLG),DSN=yourdatasetnamehere
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLIN DD *
COPY FROM(SIN1) TO(SOUT) USING(CTL1)
COPY FROM(SIN2) TO(SOUT) USING(CTL2)
COPY FROM(SIN3) TO(SOUT) USING(CTL3)
COPY FROM(SIN4) TO(SOUT) USING(CTL4)
COPY FROM(SIN5) TO(SOUT) USING(CTL5)
/*
//CTL1CNTL DD *
INREC OVERLAY=(81:C'11111111')
//CTL2CNTL DD *
INREC OVERLAY=(81:C'22222222')
//CTL3CNTL DD *
INREC OVERLAY=(81:C'33333333')
//CTL4CNTL DD *
INREC OVERLAY=(81:C'44444444')
//CTL5CNTL DD *
INREC OVERLAY=(81:C'55555555')
|
|
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Techslam,
Since all files are of same lrecl and recfm , it is easy to have delimiter and copy them easily into 1 big file. Use the following DFSORT JCL which will give you the desired results. I used $$ as delimiter , if your input has $$ in pos 1-2 , then change the delimiter to something else.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
$$
// DD *
MY 1ST FILE RECORD - 1
// DD *
$$
// DD *
MY 2ND FILE RECORD - 1
MY 2ND FILE RECORD - 2
// DD *
$$
// DD *
MY 3RD FILE RECORD - 1
MY 3RD FILE RECORD - 2
MY 3RD FILE RECORD - 3
// DD *
$$
// DD *
MY 4TH FILE RECORD - 1
MY 4TH FILE RECORD - 2
MY 4TH FILE RECORD - 3
MY 4TH FILE RECORD - 4
// DD *
$$
// DD *
MY 5TH FILE RECORD - 1
MY 5TH FILE RECORD - 2
MY 5TH FILE RECORD - 3
MY 5TH FILE RECORD - 4
MY 5TH FILE RECORD - 5
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'$$'),PUSH=(81:ID=1)),
IFTHEN=(WHEN=(81,1,ZD,EQ,1),OVERLAY=(81:9C'1')),
IFTHEN=(WHEN=(81,1,ZD,EQ,2),OVERLAY=(81:9C'2')),
IFTHEN=(WHEN=(81,1,ZD,EQ,3),OVERLAY=(81:9C'3')),
IFTHEN=(WHEN=(81,1,ZD,EQ,4),OVERLAY=(81:9C'4')),
IFTHEN=(WHEN=(81,1,ZD,EQ,5),OVERLAY=(81:9C'5'))
OUTFIL OMIT=(1,2,CH,EQ,C'$$')
//* |
|
|
| Back to top |
|
 |
Escapa
Senior Member

Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
| Kolusu wrote: |
| I used $$ as delimiter |
..
This was cool.. |
|
| Back to top |
|
 |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
Ok, My JCL looks like this as per my requirement :
My all five input files are of LRECL=1500, want to insert a 9 byte value at position 1175 and from 1184 till 1500 I want spaces.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
$$
// DD DSN=INPUT.FILE1,DISP=SHR
// DD *
$$
// DD DSN=INPUT.FILE2,DISP=SHR
// DD *
$$
// DD DSN=INPUT.FILE3,DISP=SHR
//SORTOUT DD DSN=OUTPUT.FILE,DISP=(NEW,CATLG,DELETE)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'$$'),PUSH=(1500:ID=1)),
IFTHEN=(WHEN=(1500,1,ZD,EQ,1),OVERLAY=(1175:C'834728178',1184:317X)),
IFTHEN=(WHEN=(1500,1,ZD,EQ,2),OVERLAY=(1175:C'441259166',1184:317X)),
IFTHEN=(WHEN=(1500,1,ZD,EQ,3),OVERLAY=(1175:C'482424158',1184:317X)),
OUTFIL OMIT=(1,2,CH,EQ,C'$$')
//*
|
When i submit this JCL i get the error as :
| Code: |
OUTFIL OMIT=(1,2,CH,EQ,C'$$')
$
INVALID INREC OR OUTREC STATEMENT OPERAND
|
When I removed the OUTFIL and then submited, I get a diference error as:
| Code: |
INVALID DATA SET ATTRIBUTES: SORTIN LRECL - REASON CODE IS 05
|
Where am I going wrong. Please guide me. Thanks |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
| Code: |
INVALID INREC OR OUTREC STATEMENT OPERAND
INVALID DATA SET ATTRIBUTES: SORTIN LRECL - REASON CODE IS 05 |
Post the message id's for these. |
|
| Back to top |
|
 |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
Hi, Please find the message ID below :
| Code: |
| ICE104A 0 INVALID INREC OR OUTREC STATEMENT OPERAND |
| Code: |
| ICE043A 3 INVALID DATA SET ATTRIBUTES: SORTIN LRECL - REASON CODE IS 05 |
thanks |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Can you show the all the sort card data?
Have you missed off the last comma before OUTFIL? |
|
| Back to top |
|
 |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
This is how my complete JCL looks :
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
$$
// DD DSN=INPUT.FILE1,DISP=SHR
// DD *
$$
// DD DSN=INPUT.FILE2,DISP=SHR
// DD *
$$
// DD DSN=INPUT.FILE3,DISP=SHR
//SORTOUT DD DSN=OUTPUT.FILE,DISP=(NEW,CATLG,DELETE)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'$$'),PUSH=(1500:ID=1)),
IFTHEN=(WHEN=(1500,1,ZD,EQ,1),OVERLAY=(1175:C'834728178',1184:317X)),
IFTHEN=(WHEN=(1500,1,ZD,EQ,2),OVERLAY=(1175:C'441259166',1184:317X)),
IFTHEN=(WHEN=(1500,1,ZD,EQ,3),OVERLAY=(1175:C'482424158',1184:317X)),
OUTFIL OMIT=(1,2,CH,EQ,C'$$')
//* |
|
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I was looking at your cards, which I thought someone else provided!
Remove the last comma before the OUTFIL.... |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
For your second problem, your input files magically changed from fixed 80 to fixed non-80.
Then, you try to concatenate non-80s and 80s (the DD *): you can't do that, so you get the error.
I suppose one way would be to generate the delimiter as a 1500 (or whatever it is as the time) fixed records, and then include it in the concatenated DD five times instead of doing it with the DD *. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| techslam wrote: |
| My all five input files are of LRECL=1500, want to insert a 9 byte value at position 1175 and from 1184 till 1500 I want spaces. |
techslam,
Is it really that difficult to provide that vital piece of information in your first post itself? Now a day later will you say your input files are VB? You are just wasting my time as well as your time. Bill already explained the 2 problems you have with your JCL. |
|
| Back to top |
|
 |
techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
@Skolusu
I apologise for not providing complete requirement. I actually wanted to give a similar scenario and try rest by my own from the code that you provided. It was of much helpful. Thanks a lot. Yes, I created a dummy delimetr file of LRECL=1500 with $$ in first two bytes positiopn and rest of your code just worked perfectly. Thanks everyone and ZSkolusu especially for taking time to solve this for me. I really appreciate the help |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|