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
 

 

DFSORT- Adding sequence number to sorted file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: DFSORT- Adding sequence number to sorted file
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Fri Oct 10, 2008 9:12 pm    Post subject:
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    Post subject: Reply to: DFSORT- Adding sequence number to sorted file
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    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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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