Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Selected no of rows with Header and trailer records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
nileshyp

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Wed Feb 03, 2010 11:02 am    Post subject: Selected no of rows with Header and trailer records
Reply with quote

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
View user's profile Send private message

nileshyp

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Wed Feb 03, 2010 11:04 am    Post subject: Reply to: Selected no of rows with Header and trailer record
Reply with quote

sorry.. forgot to add that I need file with 100 records with Header and Trailer record
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1238
Location: Richfield, MN, USA

PostPosted: Wed Feb 03, 2010 11:06 am    Post subject:
Reply with quote

Your "AND" should be "OR". Something can't have 2 different values at the same time.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Feb 03, 2010 11:08 am    Post subject:
Reply with quote

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
Code:
SORT FIELDS=COPY


I m not sure what output u r looking for. Once u specify the requirement i can provide you sort card
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Feb 03, 2010 11:11 am    Post subject:
Reply with quote

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
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Feb 03, 2010 11:18 am    Post subject:
Reply with quote

Hello Gerry,

I dont think it wll work as it will return only header & Trailer Records
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Feb 03, 2010 11:22 am    Post subject:
Reply with quote

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
View user's profile Send private message
nileshyp

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Wed Feb 03, 2010 11:23 am    Post subject: Reply to: Selected no of rows with Header and trailer record
Reply with quote

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
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Feb 03, 2010 11:29 am    Post subject:
Reply with quote

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
View user's profile Send private message
nileshyp

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Wed Feb 03, 2010 11:38 am    Post subject: Reply to: Selected no of rows with Header and trailer record
Reply with quote

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
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Feb 03, 2010 11:40 am    Post subject:
Reply with quote

Hello Nilesh,

You need to change DD name of output file as OUT1 instead of SORTOUT1
Back to top
View user's profile Send private message
nileshyp

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Wed Feb 03, 2010 11:53 am    Post subject: Reply to: Selected no of rows with Header and trailer record
Reply with quote

Excellent... The soultion given worked well.
Great Help.. Thanks Guptae..
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Feb 04, 2010 12:02 am    Post subject: Reply to: Selected no of rows with Header and trailer record
Reply with quote

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:

www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us