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
 

 

sort a file having header and trailer records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Mahua Mitra

New User


Joined: 26 Apr 2007
Posts: 49
Location: Delhi

PostPosted: Fri Jul 13, 2007 2:43 pm    Post subject: sort a file having header and trailer records
Reply with quote

Hi,
I have a file having header and trailer records. My requirement is to sort both the fields. if the header is 'BANK ACCT' then bank account number should be written in the oupu file, and if the 14th-17th position is PREV , then the check number must be in the output file. I need this to be done in a single sort step.

BANK ACCT 001036

CHECK CHECK
NUMBER STATUS ISSUE AMOUNT ACTG DATE PAID DAT

19900000 PREV $4,000.00 6 15 1997
CURR
CNCL $4,000.00 6 15 1997


Thanks in advance,
Mahua
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Jul 13, 2007 2:52 pm    Post subject: Re: sort a file having header and trailer records
Reply with quote

Mahua Mitra wrote:

Code:
BANK ACCT  001036                                                     

CHECK            CHECK                                         
NUMBER           STATUS     ISSUE AMOUNT   ACTG DATE   PAID DAT

19900000         PREV        $4,000.00     6 15 1997         
                 CURR     
                 CNCL        $4,000.00     6 15 1997         
You have given a fine example of your input, how about a fine example of you expected output?
Back to top
View user's profile Send private message
Mahua Mitra

New User


Joined: 26 Apr 2007
Posts: 49
Location: Delhi

PostPosted: Fri Jul 13, 2007 3:16 pm    Post subject:
Reply with quote

My ouput must be
001036
19900000

Thanks in advance
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Jul 13, 2007 3:53 pm    Post subject:
Reply with quote

Mahua Mitra
Here you go
Code:
//*******************************************************               
//STEP1    EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
BANK ACCT  001036                                                       
CHECK            CHECK                                                 
NUMBER           STATUS     ISSUE AMOUNT   ACTG DATE   PAID DAT         
19900000         PREV        $4,000.00     6 15 1997                   
                 CURR                                                   
                 CNCL        $4,000.00     6 15 1997                   
/*                                                                     
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
           SORT FIELDS=COPY                                             
 INCLUDE COND=(1,9,CH,EQ,C'BANK ACCT',OR,18,4,CH,EQ,C'PREV')           
 OUTREC IFTHEN=(WHEN=(1,9,CH,EQ,C'BANK ACCT'),BUILD=(12,6)),   
        IFTHEN=(WHEN=(18,4,CH,EQ,C'PREV'),BUILD=(1,8))                 
/*                                                                     
SORTOUT
Code:
----+----1
001036   
19900000 
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 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


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