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

SYNCSORT Copy Header rec Sort the rest


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Superior Member


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

PostPosted: Fri Sep 03, 2010 5:59 pm
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
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

Moderator Emeritus


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

PostPosted: Sun Sep 05, 2010 10:04 pm
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
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: 1702
Location: Australia

PostPosted: Mon Sep 06, 2010 9:41 am
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
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

Superior Member


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

PostPosted: Mon Sep 06, 2010 3:19 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts VB to VB copy - Full length reached SYNCSORT 8
Search our Forums:

Back to Top