Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Reformat File using field of Header

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

New User


Joined: 27 Aug 2008
Posts: 32
Location: Brazil

PostPosted: Sat Jan 22, 2011 7:49 pm    Post subject: Reformat File using field of Header
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    Post subject:
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: 32
Location: Brazil

PostPosted: Mon Jan 24, 2011 8:08 pm    Post subject: Reply to: Reformat File using field of Header
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    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 ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts unable to set RC = 4 when empty file migusd SYNCSORT 1 Tue Nov 21, 2017 1:21 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us