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

Reformat File using field of Header


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jackare

New User


Joined: 27 Aug 2008
Posts: 35
Location: Brazil

PostPosted: Sat Jan 22, 2011 7:49 pm
Reply with quote

Hello folks!
I need some help here.

This is my SORTIN

Code:
00 0000 HEADER   0002
01 0001 01.01.2011
01 0002 31.12.2010
01 0003 28.11.2010
99 9999 TRAILER  0003
00 0000 HEADER   0001
01 0001 08.01.2011
99 9999 TRAILER  0001

Layout of SORTIN

a) The layout of the first 8 characters for all types of records is the same:
(01,02,ch) --> Record type: 00 is Header, 01 is detail, 99 is Trailer
(03,01,ch) --> Filler (space)
(04,04,ch) --> Record sequence: 0000 is Header, 9999 is Trailer and 0001 til 9998 is reserved to record detail.
(08,01,ch) --> Filler (space)

b) Header
(09,09,ch) --> Fileid Text (Its is the same for all fileid number)
(18,04,ch) --> Fileid number (This field is different for each Header and is very important to my process)

c) trailer
(09,09,ch) --> Fileid Text (Its is the same for all fileid number, it's not important to my process)
(18,04,ch) --> Total detail records

Well, let's go to the grand finale: In my sortin there are two files into one, because the file has two headers and two trailers. I have to include the fileid field in all records from the header to the trailer, then I have to sort the file using this new field.
This is the result expected

Code:
00 0000 HEADER   0001 0001
01 0001 08.01.2011    0001
99 9999 TRAILER  0001 0001
00 0000 HEADER   0002 0002
01 0001 01.01.2011    0002
01 0002 31.12.2010    0002
01 0003 28.11.2010    0002
99 9999 TRAILER  0003 0002


The last 4 chars corresponding to position (18,04,ch) of Header.

Thanks!
Back to top
View user's profile Send private message
Guest







PostPosted: Mon Jan 24, 2011 12:54 pm
Reply with quote

Hi,
The following DFSORT statements will do what you want icon_smile.gif

Code:


//SYSIN    DD  *                                                   
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'00'),PUSH=(23:18,4))
  OPTION EQUALS                                                   
  SORT FIELDS=(23,4,CH,A)                                         



devil13
There is always a better solution.
Back to top
jackare

New User


Joined: 27 Aug 2008
Posts: 35
Location: Brazil

PostPosted: Mon Jan 24, 2011 8:08 pm
Reply with quote

Hi devil13,
Yes, it's working very well. Thanks a lot!
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top