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 file having multiple Headers

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
suhaas02

New User


Joined: 16 Jul 2012
Posts: 7
Location: India

PostPosted: Mon Jul 16, 2012 6:19 pm    Post subject: SORT file having multiple Headers
Reply with quote

Hi All,

I have report file with below structure. It has multiple headers (one after 4 records).
The below file is sorted on EMP-ID. I want to sort it on NAME without distrubing header structure.


1********************************************** ---- Header 1
Report Name PAGE : 1 ---- Header 2
********************************************** ---- Header 3
EMP-ID NAME SALARY DEPT ---- Header 4
11111 AAA 10000 IT ---- Main Data
22222 CCC 20000 HR ---- Main Data
33333 GGG 30000 ADMN ---- Main Data
44444 EEE 30000 IT ---- Main Data
1**********************************************
Report Name PAGE : 2
**********************************************
EMP-ID NAME SALARY DEPT
55555 DDD 10000 IT
66666 BBB 20000 HR
77777 HHH 30000 ADMN
88888 FFF 30000 IT
00000008 ---- Trailor


Required output should be sorted on NAME and there should be headers in place (each after every 4 records)


1********************************************** ---- Header 1
Report Name PAGE : 1 ---- Header 2
********************************************** ---- Header 3
EMP-ID NAME SALARY DEPT ---- Header 4
11111 AAA 10000 IT ---- Main Data
66666 BBB 20000 HR ---- Main Data
22222 CCC 20000 HR ---- Main Data
55555 DDD 10000 IT ---- Main Data
1**********************************************
Report Name PAGE : 2
**********************************************
EMP-ID NAME SALARY DEPT
44444 EEE 30000 IT
88888 FFF 30000 IT
33333 GGG 30000 ADMN
77777 HHH 30000 ADMN

00000008 ---- Trailor
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Mon Jul 16, 2012 6:26 pm    Post subject: Reply to: SORT file having multiple Headers
Reply with quote

Yous, to the initial glance, is a simpler version of this problem. Does the solution there help you out?
Back to top
View user's profile Send private message
suhaas02

New User


Joined: 16 Jul 2012
Posts: 7
Location: India

PostPosted: Mon Jul 16, 2012 7:16 pm    Post subject: Re: Reply to: SORT file having multiple Headers
Reply with quote

I tried doing SORT using DFSORT utility. However its grouping all headers, then main data and then after trailors.

I am expecting headers then 4 main data records, then header again 4 main data records and at last trailor.

Please help me.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Mon Jul 16, 2012 7:56 pm    Post subject: Reply to: SORT file having multiple Headers
Reply with quote

You have a file whose "general" order you want to maintain but want to sort within that.

Did you read the other thread? What did you not understand? What, by showing us the code, did you actually try?
Back to top
View user's profile Send private message
suhaas02

New User


Joined: 16 Jul 2012
Posts: 7
Location: India

PostPosted: Mon Jul 16, 2012 8:01 pm    Post subject: Re: Reply to: SORT file having multiple Headers
Reply with quote

Actually I just want to sort on main data and after that want to enclose those with headers.

Can we do that using two files. I have now headers in one file and main data (sorted) into another file. Can we copy first 4 records from header file to output file then 4 records from main data file to output. Again 4 from header file and 4 from main data file?

Waiting
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Mon Jul 16, 2012 8:24 pm    Post subject: Reply to: SORT file having multiple Headers
Reply with quote

Waiting?

Yes, you can do it either way. Have you split the file to do this specifically, or is it like that already?
Back to top
View user's profile Send private message
suhaas02

New User


Joined: 16 Jul 2012
Posts: 7
Location: India

PostPosted: Mon Jul 16, 2012 8:34 pm    Post subject: Re: Reply to: SORT file having multiple Headers
Reply with quote

Sorry for late reply...

I splitted it into two...One file having only headers and another is having main data...
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Jul 16, 2012 9:46 pm    Post subject: Re: Reply to: SORT file having multiple Headers
Reply with quote

suhaas02 wrote:
Sorry for late reply...

I splitted it into two...One file having only headers and another is having main data...


Suhaas02,

You don't have to split the file into 2 and then sort on it. You can do it all in single step.

1. What is the LRECL and RECFM of the input file?
2. What is the LRECL and RECFM of the output file?
3. Can the headers be generated? ( most the header data is constant, so we can generate it later)
4. How do you identify the header records? ex: like this
Code:

(1,1,CH,EQ,C'1',OR,         
 2,6,CH,EQ,C'REPORT',OR,   
 2,6,CH,EQ,C'******',OR,   
 2,6,CH,EQ,C'EMP-ID')       
Back to top
View user's profile Send private message
suhaas02

New User


Joined: 16 Jul 2012
Posts: 7
Location: India

PostPosted: Tue Jul 17, 2012 12:23 pm    Post subject: Re: Reply to: SORT file having multiple Headers
Reply with quote

Skolusu wrote:
suhaas02 wrote:
Sorry for late reply...

I splitted it into two...One file having only headers and another is having main data...


Suhaas02,

You don't have to split the file into 2 and then sort on it. You can do it all in single step.

1. What is the LRECL and RECFM of the input file?
133 FB
2. What is the LRECL and RECFM of the output file?
133 FB
3. Can the headers be generated? ( most the header data is constant, so we can generate it later)
The header contains PAGE NO. it should get updated everytime we write it after 4 records. If it is possible to update PAGE NO., then its OK.
4. How do you identify the header records? ex: like this
Code:

(1,1,CH,EQ,C'1',OR,         
 2,6,CH,EQ,C'REPORT',OR,   
 2,6,CH,EQ,C'******',OR,   
 2,6,CH,EQ,C'EMP-ID')       


That's perfect
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jul 17, 2012 11:17 pm    Post subject:
Reply with quote

Use the following DFSORT JCL which will give you the desired results. I assumed that your key to be sorted is at position 8 for 4 bytes.

Code:

//STEP0100 EXEC PGM=SORT     
//SYSOUT   DD SYSOUT=*       
//SORTIN   DD DSN=Your Input FB 133 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                     
  OMIT COND=(1,1,CH,EQ,C'1',OR,                                     
             2,6,CH,EQ,C'REPORT',OR,                                 
             2,6,CH,EQ,C'******',OR,                                 
             2,6,CH,EQ,C'EMP-ID')                                   
                                                                     
  SORT FIELDS=(8,4,CH,A),EQUALS                                           
  OUTFIL REMOVECC,LINES=8,                                           
  HEADER2=('1',132'*'/,                                             
           2:'REPORT NAME:  IBM DATA REPORT',110:'PAGE : ',PAGE,/,   
           133'*'/,                                                 
           2:'EMP-ID NAME SALARY DEPT')                             
//*
Back to top
View user's profile Send private message
suhaas02

New User


Joined: 16 Jul 2012
Posts: 7
Location: India

PostPosted: Mon Aug 06, 2012 4:10 pm    Post subject:
Reply with quote

I was on leave so couldn't reply on time...I really worked for LRECL 80 and not for 133...
I think some minor changes are required...

Thanks to all for support and help !!!
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Mon Aug 06, 2012 5:07 pm    Post subject:
Reply with quote

suhaas02 wrote:
I was on leave so couldn't reply on time...I really worked for LRECL 80 and not for 133...
I think some minor changes are required...

Thanks to all for support and help !!!


So you're going to manage the change from 133 to 80 yourself?
Back to top
View user's profile Send private message
suhaas02

New User


Joined: 16 Jul 2012
Posts: 7
Location: India

PostPosted: Mon Aug 06, 2012 5:21 pm    Post subject:
Reply with quote

I have read it when I did some search on old posts...I will find it and then test it...
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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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