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

Extract only those records whose RECORD-ID in Syncsort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rgarg

New User


Joined: 15 Feb 2006
Posts: 18

PostPosted: Fri Jul 06, 2007 8:20 am
Reply with quote

Following is my requirement,

I have input file say of record length 200 fixed length and the records are in the following format,

ORG PIC 9(03)
ACCOUNT NUMBER PIC X(19)
RECORD-ID PIC X(2)
NAME PIC (30)
ADDRESS PIC X(40)
PHONE PIC 9(15)
CUSTOMER NUMBER PIC 9(19)
FILLER PIC X(73)


The output file should of record length 45(Fixed format) with the following record layout :

01 or 02 (depending on value of RECORD-ID need to be inserted at first 2 postions)

ORG

ACCOUNT NUMBER

RECORD-ID

CUSTOMER NUMBER



Following is the output file requirement

1. I want to extract only those records whose RECORD-ID is either BS or NA

2. I want to take only values of ORG, ACCOUNT NUMBER, RECORD-ID and CUSTOMER NUMBER from the input file

3. If RECORD-ID is BS insert 01 at first 2 positions, if it is NA, insert 02 at first 2 positions

4. Thus the total length of output file is 45

Can someone please tell me how to achieve this. My shop has Syncsort utility.

Thanks and Regards
Rajiv Garg
Back to top
View user's profile Send private message
a027412

New User


Joined: 05 Jul 2007
Posts: 40
Location: Minneapolis, MN

PostPosted: Fri Jul 06, 2007 10:09 am
Reply with quote

Code:

//STEP01  EXEC  SORT                                   
//SORTIN   DD  DSN=InputDataSet,             
//             DISP=SHR                                   
//SORTOUT  DD  DSN=OutputDataSet,                   
//             DISP=(NEW,CATLG,DELETE),                   
//             UNIT=SYSDA,SPACE=(CYL,(800,200),RLSE),     
//             DCB=(LRECL=45,RECFM=FB,BLKSIZE=0)         
//SYSIN  DD  *                                           
 INCLUDE COND=(23,2,CH,EQ,C'BS',OR,23,2,CH,EQ,C'NA')     
 OUTREC FIELDS=(1:23,2,CHANGE=(2,C'BS',C'01',C'NA',C'02'),
                  3:1,24,                                 
                  27:110,19)                             
 SORT FIELDS=COPY                                         
/*                                                       
Back to top
View user's profile Send private message
rgarg

New User


Joined: 15 Feb 2006
Posts: 18

PostPosted: Sat Jul 07, 2007 6:20 am
Reply with quote

The Code works. Thanks you so much for the help. But i can't able to get the sort card here i.e. Can you please explain me this sort card?
Back to top
View user's profile Send private message
a027412

New User


Joined: 05 Jul 2007
Posts: 40
Location: Minneapolis, MN

PostPosted: Sat Jul 07, 2007 2:00 pm
Reply with quote

the INCLUDE COND, picks only the input record containing BS or NA at the position 23 to 24

In the OUTREC,
Output position 1, pick characters from 23 to 24 from the input record and change the character BS to 01 or NA to 02
Output position 3, pick characters from 1 to 24 from the input record
Output position 27, pick characters from 110 to 129 from the input record
Back to top
View user's profile Send private message
rgarg

New User


Joined: 15 Feb 2006
Posts: 18

PostPosted: Sat Jul 07, 2007 6:01 pm
Reply with quote

Thanks for making me understand. Thank you very much for the help icon_smile.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top