View previous topic :: View next topic
Author
Message
jemonthomas New User Joined: 24 Jul 2006Posts: 35 Location: india
Hi,
In a Jcl I need to write a header when ever space comes in the input record.Could anyone help me in writing header based on this condition?
Back to top
vasanthz Global Moderator Joined: 28 Aug 2007Posts: 1742 Location: Tirupur, India
Hi,
Show us a sample of input and the output records & the rules, someone might be able to help.
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
To add to Vasanthz's request, tell us what program you'd like the JCL to use to do this, please.
Back to top
Soumik Das New User Joined: 06 Aug 2011Posts: 25 Location: India
Quote:
when ever space comes in the input record
What do you exactly mean by that?
Some examples might help us understand your requirement better.
Back to top
jemonthomas New User Joined: 24 Jul 2006Posts: 35 Location: india
For Example Input file looks as below
ABCD Thomas
ABCD James
ABCD Tom
BCDE Charlie
BCDE Mahesh
BCDE Sunil
CDEF Sachin
CDEF Arun
Output file should looks like
Sl No: Name
ABCD Thomas
ABCD James
ABCD Tom
Sl No: Name
BCDE Charlie
BCDE Mahesh
BCDE Sunil
Sl No: Name
CDEF Sachin
CDEF Arun
Back to top
Bill Woodger Moderator Emeritus Joined: 09 Mar 2011Posts: 7309 Location: Inside the Matrix
If you want to use Sort:
Put in an IF in an Outrec which identifies a blank record, use the Slash operator (if Syncsort has that or an equivalent), outputting your blank first and then generating the header.
Back to top
bodatrinadh Active User Joined: 05 Jan 2007Posts: 101 Location: chennai (India)
Here is the code...
Code:
//S1A EXEC PGM=SORT
//$ORTPARM DD DSN=IMS.PARMLIB(IMSMS005),DISP=SHR
//SORTIN DD *
ABC THOMAS
ABC RICHARD
ABC MATHEW
ABC TOM
BCD NEENA
BCD NAMITHA
BCD NISHA
CDE ARUN
CDE NIRMAL
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=(1,3,CH,NE,C' '),BUILD=(1,3,X,5,10,X,16:SEQNUM,
8,ZD,RESTART=(1,3))),
IFTHEN=(WHEN=(1,3,CH,EQ,C' '),BUILD=(1,3,X,5,10))
SORT FIELDS=COPY
OUTFIL IFOUTLEN=80,
IFTHEN=(WHEN=(16,8,ZD,GT,1),BUILD=(1,03,4X,5,10,61X)),
IFTHEN=(WHEN=(16,8,ZD,EQ,1),BUILD=(C'SL NO: NAME',/,1,03,4X,5,10,61X))
Your output:-
Code:
SL NO: NAME
ABC THOMAS
ABC RICHARD
ABC MATHEW
ABC TOM
SL NO: NAME
BCD NEENA
BCD NAMITHA
BCD NISHA
SL NO: NAME
CDE ARUN
CDE NIRMAL
Thanks
-3nadh
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Or even this.
Code:
//SYSIN DD *
OPTION COPY
OUTREC OVERLAY=(81:SEQNUM,8,ZD)
OUTFIL IFTHEN=(WHEN=(01,1,CH,EQ,C' '),
BUILD=(1,80,/,C'SL NO: NAME')),
IFTHEN=(WHEN=(81,8,ZD,EQ,1),
BUILD=(C'SL NO: NAME',/,1,80)),IFOUTLEN=80
Back to top
Please enable JavaScript!