IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sequence number in SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Rajesh1979

New User


Joined: 24 Dec 2007
Posts: 9
Location: Chennai

PostPosted: Sat Apr 24, 2010 3:59 pm
Reply with quote

Hi,

I want the header record to be skipped while adding the sequence no at the end of the file.
The header file should be copied as it is from input file.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Sat Apr 24, 2010 4:09 pm
Reply with quote

What are the attributes of the input file
DSORG, RECFM, LRECL
Back to top
View user's profile Send private message
Rajesh1979

New User


Joined: 24 Dec 2007
Posts: 9
Location: Chennai

PostPosted: Sat Apr 24, 2010 4:27 pm
Reply with quote

RECFM=FB,LRECL=381,DSORG=PS
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Sat Apr 24, 2010 11:16 pm
Reply with quote

Rajesh1979 wrote:
Hi,

I want the header record to be skipped while adding the sequence no at the end of the file.
The header file should be copied as it is from input file.


Rajesh, What you are trying to ask is not at all clear.

Can you please show us sample example for what you want.
Back to top
View user's profile Send private message
Rajesh1979

New User


Joined: 24 Dec 2007
Posts: 9
Location: Chennai

PostPosted: Sun Apr 25, 2010 8:13 am
Reply with quote

Sambhaji,

Here is some sample layout of input.


HEADER123
WWW3234232
XXX43432432
YYY13123213
ZZZ33123232


Incorrect Output file:

HEADER123 01
WWW323423202
XXX4343243203
YYY1312321304
ZZZ3312323205

Desired Output file:

HEADER123
WWW323423201
XXX4343243202
YYY1312321303
ZZZ3312323204

with sequence no 01,03,03,04,05 added at the end of record.

But I dont want any sequence number for header record HEADER123.
The header record should be written in the output file with out any sequence number.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon Apr 26, 2010 11:54 am
Reply with quote

Assumed INPUT LRECL=15 and
Code:

//S1    EXEC  PGM=SORT                                             
//SORTIN DD *                                                       
HEADER123                                                           
WWW3234232                                                         
XXX43432432                                                         
YYY13123213                                                         
ZZZ33123232                                                         
//SORTOUT DD SYSOUT=*                                               
//SYSOUT    DD  SYSOUT=*                                           
//SYSIN    DD  *                                                   
  SORT FIELDS=COPY                                                 
  INREC IFTHEN=(WHEN=(1,6,CH,NE,C'HEADER'),OVERLAY=(16:SEQNUM,4,ZD))
  OUTFIL BUILD=(1,19)                                               
/*                                                                 

Output will be:
Code:

HEADER123                     
WWW3234232     0001           
XXX43432432    0002           
YYY13123213    0003           
ZZZ33123232    0004           
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Apr 26, 2010 10:44 pm
Reply with quote

I believe this DFSORT solution more closely fits the description of what's wanted, but adjust as needed.

Code:

//S1    EXEC  PGM=SORT                                               
//SYSOUT    DD  SYSOUT=*                                             
//SORTIN DD DSN=...  input file (FB/381)                           
//SORTOUT DD DSN=...  output file (FB/383)       
//SYSIN    DD  *                                                     
  OPTION COPY                                                         
  INREC IFTHEN=(WHEN=(1,6,CH,NE,C'HEADER'),
      OVERLAY=(382:SEQNUM,2,ZD))
/*                                                                   
Back to top
View user's profile Send private message
Rajesh1979

New User


Joined: 24 Dec 2007
Posts: 9
Location: Chennai

PostPosted: Tue Apr 27, 2010 12:34 pm
Reply with quote

Thanks Sambhaji and Frank.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top