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
 

 

SYNCSORT Copy Header rec Sort the rest

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

New User


Joined: 22 Feb 2006
Posts: 27

PostPosted: Fri Sep 03, 2010 5:24 pm    Post subject: SYNCSORT Copy Header rec Sort the rest
Reply with quote

Hi,
I have an input file which contains a header record and a set of detail records. I want to copy the header record(unsorted) and then sorted output for the rest of the detail records in my output record. Is there any way i can do this in SYNCSORT.
Back to top
View user's profile Send private message

Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Sep 03, 2010 5:59 pm    Post subject:
Reply with quote

Quote:
Is there any way i can do this in SYNCSORT.
Yes, there is. please show us sample input and the expected output from that. Please tell us the LRECL/RECFM of input/output also.
Back to top
View user's profile Send private message
morfius9
Warnings : 1

New User


Joined: 22 Feb 2006
Posts: 27

PostPosted: Sun Sep 05, 2010 6:52 pm    Post subject:
Reply with quote

Input File -
XXXXABCDEF
0001NO03MOUNTAIN
0001NO01HILL
0001NO02STREAM
Output File
XXXXABCDEF
0001NO01HILL
0001NO02STREAM
0001NO03MOUNTAIN

The first record which is the header needs to be in the output file as well - same format as in the input file. The output file should be sorted on the second field beginning offset 04, length 04 - alphanumeric.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Sep 05, 2010 10:04 pm    Post subject:
Reply with quote

Hello,

To get help, you need to provide requested info. . .

Quote:
Please tell us the LRECL/RECFM of input/output also

Someone could guess, but why should they. . . icon_sad.gif
Back to top
View user's profile Send private message
morfius9
Warnings : 1

New User


Joined: 22 Feb 2006
Posts: 27

PostPosted: Mon Sep 06, 2010 9:24 am    Post subject:
Reply with quote

My bad. LRECL=200. RECFM=FB of both input & output. Also, XXXX in the input file is low values - if that helps.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Mon Sep 06, 2010 9:41 am    Post subject:
Reply with quote

Hi,

are the first 4 bytes of the detail records always 0001 ? if so you can use
Code:
  SORT FIELDS=(1,8,BI,A) 



Gerry
Back to top
View user's profile Send private message
morfius9
Warnings : 1

New User


Joined: 22 Feb 2006
Posts: 27

PostPosted: Mon Sep 06, 2010 1:30 pm    Post subject:
Reply with quote

Input File -
XXXXABCDEF
0001NO03MOUNTAIN
0001NO01HILL
0001NO02STREAM
Output File
XXXXABCDEF
0001HILL NO01
0001STREAM NO02
0001MOUNTAINNO03

Im having to do a reformatting as well now for a file compatibility with other downstream processes using the same file. For this i need to move the Numbering to the end as shown above. In this case my header's ABCDEF is splitting up because im moving the fields around. Is there any way to get the same header record & only have the INREC/SORT statements work on the data records?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Sep 06, 2010 3:19 pm    Post subject:
Reply with quote

Your latest example is different than what you have showed in your earlier post. Also, you have not used Bbcode. I tried to align your input/output suign BBcode, however, they did not align well - so I left them as is. Could you please post themm back with proper alignment using BBcode.

Also, what Sort product are you using - if it's SyncSort what release of it are you using? If you tell this may be we can use DATASORT parameter.

On the other hand, keeping the header intact, and sorting "data-fields", you can use the below Job as reference, assuming that your input is FB recfm and 80 bye LRECL and your key to be sorted is first 9 bytes.
Code:
//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                           
XXXXXXX  - HEADER PART                                   
ZZZZZZZ  - DATA PART                                     
TTTTTTTT - DATA PART                                     
DDDDDD   - DATA PART                                     
BBBBBBB  - DATA PART                                     
AAAAAAA  - DATA PART                                     
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),     
  IFTHEN=(WHEN=(81,8,ZD,GT,1),OVERLAY=(81:C'2'))         
  SORT FIELDS=(81,1,CH,A,1,9,CH,A),EQUALS                 
  OUTREC BUILD=(1,80)                                     
/*

output
Code:
XXXXXXX  - HEADER PART   
AAAAAAA  - DATA PART     
BBBBBBB  - DATA PART     
DDDDDD   - DATA PART     
TTTTTTTT - DATA PART     
ZZZZZZZ  - DATA PART     
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 Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts copy SEQ to PDS and create stats steve-myers JCL & VSAM 5 Thu Apr 27, 2017 1:15 am
No new posts Copy load modules and alias vasanthz IBM Tools 5 Thu Apr 20, 2017 6:31 am


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