View previous topic :: View next topic
Author
Message
nileshyp New User Joined: 22 Jun 2005Posts: 65 Location: Mumbai
Hi
Curretnly I have file which has 02572045 records. I want to create another file with just records with Header and trailer records. How can I achieve it using SORT. the header and Trailer records lokks as below
Code:
UHDR 2010029 100129
UTRL 02572045
I tried to do it using below code
Code:
//STEP01 EXEC PGM=SORT,REGION=4096K
//*
//SYSOUT DD SYSOUT=*
//*
//SORTIN DD DSN=TRTEGCM.DNLD.GCM701P0.SCPMERGE.G0008V00,DISP=SHR
//*
//SORTOUT DD DSN=TRTEGCM.DNLD.GCM701P0.SCPMERGE(+1),
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// DCB=(SYSL.MODEL,LRECL=607,BLKSIZE=0,RECFM=FB),
// SPACE=(TRK,(600,600),RLSE)
//*
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK04 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK05 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK06 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK07 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK08 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK09 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK10 DD UNIT=SYSDA,SPACE=(CYL,(1))
//*
//SYSIN DD *
SORT FIELDS=COPY,STOPAFT=100
INCLUDE COND=(1,4,CH,EQ,C'UHDR',AND,1,4,CH,EQ,C'UTRL')
//*
//
Job complted successfully but created empty dataset.
Appreciate help on the above.
Back to top
nileshyp New User Joined: 22 Jun 2005Posts: 65 Location: Mumbai
sorry.. forgot to add that I need file with 100 records with Header and Trailer record
Back to top
Terry Heinze JCL Moderator Joined: 14 Jul 2008Posts: 1249 Location: Richfield, MN, USA
Your "AND" should be "OR". Something can't have 2 different values at the same time.
Back to top
guptae Moderator Joined: 14 Oct 2005Posts: 1208 Location: Bangalore,India
Hello Nilesh,
Silly Mistake
For any record either first four character can be equal to UHDR or UTRL
It can not be both as you mention AND IN sort card
Code:
SORT FIELDS=COPY,STOPAFT=100
INCLUDE COND=(1,4,CH,EQ,C'UHDR',AND,1,4,CH,EQ,C'UTRL')
Secondly do you want to copy all the records then give
I m not sure what output u r looking for. Once u specify the requirement i can provide you sort card
Back to top
gcicchet Senior Member Joined: 28 Jul 2006Posts: 1702 Location: Australia
Hi,
change
Code:
INCLUDE COND=(1,4,CH,EQ,C'UHDR',AND,1,4,CH,EQ,C'UTRL')
to
Code:
INCLUDE COND=(1,4,CH,EQ,C'UHDR',OR,1,4,CH,EQ,C'UTRL')
Gerry
Back to top
guptae Moderator Joined: 14 Oct 2005Posts: 1208 Location: Bangalore,India
Hello Gerry,
I dont think it wll work as it will return only header & Trailer Records
Back to top
gcicchet Senior Member Joined: 28 Jul 2006Posts: 1702 Location: Australia
Hi Ekta,
my reply was to his original request, I re-edited my reply due to a typo
The additional information was not there when I commenced my reply.
Gerry
Back to top
nileshyp New User Joined: 22 Jun 2005Posts: 65 Location: Mumbai
I tried witht given solution but the output is just 2 records as follows
Code:
UHDR 2010029 100129
UTRL 02572045
whereas I am expecting file with 100 records alongwith Header adn Trailer records.
Back to top
guptae Moderator Joined: 14 Oct 2005Posts: 1208 Location: Bangalore,India
Hello Nilesh,
One way to acheive this is using below sort card. Its not an optimal solution but provide you desired output
Code:
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=INIT,
OVERLAY=(608:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,4,CH,EQ,C'UHDR'),
OVERLAY=(608:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,4,CH,EQ,C'UTRL'),
OVERLAY=(608:SEQNUM,8,ZD))
OUTFIL FNAMES=OUT1,
INCLUDE=(608,8,ZD,LE,100),
BUILD=(1,607)
Back to top
nileshyp New User Joined: 22 Jun 2005Posts: 65 Location: Mumbai
Hi,
I modifed my SORT JCL as below
Code:
//STEP01 EXEC PGM=SORT,REGION=4096K
//*
//SYSOUT DD SYSOUT=*
//*
//SORTIN DD DSN=TRTEGCM.DNLD.GCM701P0.SCPMERGE.G0008V00,DISP=SHR
//*
//SORTOUT1 DD DSN=TRTEGCM.DNLD.GCM701P0.SCPMERGE(+1),
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// DCB=(SYSL.MODEL,LRECL=607,BLKSIZE=0,RECFM=FB),
// SPACE=(TRK,(600,600),RLSE)
//*
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK04 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK05 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK06 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK07 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK08 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK09 DD UNIT=SYSDA,SPACE=(CYL,(1))
//SORTWK10 DD UNIT=SYSDA,SPACE=(CYL,(1))
//*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=INIT,
OVERLAY=(608:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,4,CH,EQ,C'UHDR'),
OVERLAY=(608:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(1,4,CH,EQ,C'UTRL'),
OVERLAY=(608:SEQNUM,8,ZD))
OUTFIL FNAMES=OUT1,
INCLUDE=(608,8,ZD,LE,100),
BUILD=(1,607)
//*
//
But when i executed above JCL it failed with below error
Code:
+ICE056A 9 ASPUROHT.STEP01 OUT1 ,NOT,DEFINED
IEA995I SYMPTOM DUMP OUTPUT
USER COMPLETION CODE=0056
If you look at the above JCL I have defined the SORTOUT file as SORTOUT1
Kindly advise.
Back to top
guptae Moderator Joined: 14 Oct 2005Posts: 1208 Location: Bangalore,India
Hello Nilesh,
You need to change DD name of output file as OUT1 instead of SORTOUT1
Back to top
nileshyp New User Joined: 22 Jun 2005Posts: 65 Location: Mumbai
Excellent... The soultion given worked well.
Great Help.. Thanks Guptae..
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
nileshyp,
Here is an alternative way of getting the desired results
Code:
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=TRTEGCM.DNLD.GCM701P0.SCPMERGE.G0008V00,DISP=SHR
//*
//OUT DD DSN=TRTEGCM.DNLD.GCM701P0.SCPMERGE(+1),
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(TRK,(600,600),RLSE)
//*
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) KEEP INPUT FIRST LAST RRN(2,101)
//*
For complete details on the SUBSET function and the other new functions available with PTF UK90013, see:
Use [URL] BBCode for External Links
Back to top
Please enable JavaScript!