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

DFSORT- Adding sequence number to sorted file


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

New User


Joined: 19 Mar 2008
Posts: 51
Location: Pune

PostPosted: Fri Oct 10, 2008 2:58 pm
Reply with quote

Hi

Please help

I am sorting one file using sort utility , i will sort this file only if i get a request so when i get a first request then i will sort the file and then we will put the header and trailer.
Header & Trailer will consist of sequence number
so for first request sequence number will be one. When i get a second request i should sort the file again and should increment sequence number to two.
For incrementing the sequence number i dont want to write any cobol program.
Can anybody sugget how we can increment sequence number using sort utility.

Regards
----------
Bijal
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Fri Oct 10, 2008 3:04 pm
Reply with quote

Can you post layout of the file.? how to identify header and trailer?
LRECL, RECFM?

Which sort product you using?
Back to top
View user's profile Send private message
bijal.awhad

New User


Joined: 19 Mar 2008
Posts: 51
Location: Pune

PostPosted: Fri Oct 10, 2008 3:35 pm
Reply with quote

The header record will be having the Record Type,application name(4 bytes), sequence no(6 bytes),date,time. The trailor record contains the application name(4 bytes), sequence no(6 bytes),record count(7 bytes). I have created everything except the sequence number. I am not sure how to add the sequence number. The LRECL is 30 and the RECFM is FB.
The Header Record layout follows below:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Data Element Positions Length Format
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Record Type 1 – 3 3 ‘BOF’
Blank 4 1 Blank
Sending System 5 – 8 4 ‘ABCD’
Blank 9 – 10 2 Blank
Sequence Number 11 – 16 6 Numeric
Blank 17 1 Blank
Date 18 – 23 6 YYMMDD
Blank 24 1 Blank
Time 25 – 30 6 HHMMSS

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Trailer Record layout follows below:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Data Element Positions Length Format
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Record Type 1 – 3 3 ‘EOF’
Blank 4 1 Blank
Sending System 5 – 8 4 ‘ABCD’
Blank 9 – 10 2 Blank
Sequence Number 11 – 16 6 Numeric
Blank 17 1 Blank
Record Count 18 – 24 7 Numeric
Blank 25 – 30 6 Blank

We are using DFSORT.
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Fri Oct 10, 2008 4:19 pm
Reply with quote

Code:

//SORTIN DD *                                                 
BOF ABCD  000006 YYMMDD HHMMSS                                 
01XXXXXXXXXXXXXXXXXXXXXXXXXXXX                                 
02XXXXXXXXXXXXXXXXXXXXXXXXXXXX                                 
03XXXXXXXXXXXXXXXXXXXXXXXXXXXX                                 
EOF ABCD  000006 0000003                                       
/*                                                             
//SORTOUT DD SYSOUT=*                                         
//SYSIN    DD    *                                             
   OPTION COPY                                                 
   OUTREC IFTHEN=(WHEN=(1,3,CH,EQ,C'BOF',OR,1,3,CH,EQ,C'EOF'),
          BUILD=(1,10,11,6,ZD,ADD,+1,TO=ZD,LENGTH=6,17,14))   
/*                                                             

Output:
Code:

BOF ABCD  000007 YYMMDD HHMMSS
01XXXXXXXXXXXXXXXXXXXXXXXXXXXX
02XXXXXXXXXXXXXXXXXXXXXXXXXXXX
03XXXXXXXXXXXXXXXXXXXXXXXXXXXX
EOF ABCD  000007 0000003     
Back to top
View user's profile Send private message
bijal.awhad

New User


Joined: 19 Mar 2008
Posts: 51
Location: Pune

PostPosted: Fri Oct 10, 2008 4:42 pm
Reply with quote

Thanks a lot Sambhaji..Its working fine

We need one more help. we are populating Date from system in Header record.Systen date format is MMDDYY but we want it as YYMMDD.
Please help

Regards
----------
Bijal
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Fri Oct 10, 2008 5:53 pm
Reply with quote

Code:

//SYSIN    DD    *                                           
   OPTION COPY                                               
   INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'BOF',OR,1,3,CH,EQ,C'EOF'),
    OVERLAY=(1,10,11,6,ZD,ADD,+1,TO=ZD,LENGTH=6,17,14,       
    31:DATE1))                                               
   OUTREC IFTHEN=(WHEN=(1,3,CH,EQ,C'BOF'),                   
                  BUILD=(1,17,33,6,24,7)),                   
          IFTHEN=(WHEN=NONE,                                 
                  BUILD=(1,30))                             
/*                                                           

Output:
Code:

BOF ABCD  000007 081010 HHMMSS
01XXXXXXXXXXXXXXXXXXXXXXXXXXXX
02XXXXXXXXXXXXXXXXXXXXXXXXXXXX
03XXXXXXXXXXXXXXXXXXXXXXXXXXXX
EOF ABCD  000007 0000003     
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: Fri Oct 10, 2008 9:12 pm
Reply with quote

Bijal,

Sambhaji's solution is more complex than it has to be.

Here's a better way to do what you want with DFSORT:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/30)
//SORTOUT DD DSN=...  output file (FB/30)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,3,CH,EQ,C'BOF'),
          OVERLAY=(11:11,6,ZD,ADD,+1,TO=ZD,LENGTH=6,
            18:DATENS=(YMD))),
   IFTHEN=(WHEN=(1,3,CH,EQ,C'EOF'),
          OVERLAY=(11:11,6,ZD,ADD,+1,TO=ZD,LENGTH=6))
/*
Back to top
View user's profile Send private message
bijal.awhad

New User


Joined: 19 Mar 2008
Posts: 51
Location: Pune

PostPosted: Mon Oct 13, 2008 2:44 pm
Reply with quote

Sambhaji & Frank

Thanks a lot

-----------------
Regards
Bijal
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top