|
View previous topic :: View next topic
|
| Author |
Message |
Haresh
New User
Joined: 04 Jan 2009 Posts: 18 Location: Germany
|
|
|
|
I have a requirement to include a header record after every 30 records in the output file. I have used the below JCL for this purpose
| Code: |
//STEP1 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=input ds,
// DISP=SHR
//SORTOUT DD DSN=output ds,
// DISP=(NEW,CATLG,CATLG),
// SPACE=(CYL,(100,50),RLSE),
// DCB=(RECFM=FB,LRECL=540)
//SORTWK01 DD UNIT=SYSDA,
// SPACE=(CYL,(30,30),RLSE)
//SORTWK02 DD UNIT=SYSDA,
// SPACE=(CYL,(30,30),RLSE)
//*
//SYSIN DD *
OPTION COPY -
INREC IFTHEN=(WHEN=GROUP,RECORDS=30,PUSH=(541:ID=8))
OUTFIL REMOVECC,BUILD=(1,540),
SECTIONS=(541,8,TRAILER3=(C'.........................')) |
Now the problem is that the header is around 400 characters long but within c'...' the maximum allowed is only 256 characters.
Kindly let me know whether we have any possibility to give multiple texts within the same trailer?
I also tried keeping the header in separate file and include that after every 30 records, but atleast my code is not successful and thats the reason i switched to this simple hardcoded method. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You don't need SORTWKnn for a COPY operation. You are tying up diskspace for the duration of the step for no purpose.
Why do you have the WHEN=GROUP? I can't see a purpose. Then you'd not need the BUILD.
What is the content of your "header"? Is it fixed throughout the file? |
|
| Back to top |
|
 |
Haresh
New User
Joined: 04 Jan 2009 Posts: 18 Location: Germany
|
|
|
|
thanks for the hint on the SORTWKnn, i shall remove it.
I want to repeat the fixed header after every 30 records, thats the reason i have used group function with just record option. |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
OK, the most important question you missed.
Have a look at SEQNUM with RESTART. This will be more efficient than the WHEN=GROUP.
In the OUTFIL, don't use the reporting functions if you've come to a limit, but you can use the slash operator on BUILD, which will allow you to output two records from one input record.
If you can source from a file, you could set up a number of symbols/SYMANES in a separate small step. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|