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
 

 

Formatting the records of input file

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

New User


Joined: 22 Nov 2005
Posts: 8
Location: hyderabad

PostPosted: Thu May 12, 2011 4:23 pm    Post subject: Formatting the records of input file
Reply with quote

Hi,
I need urgent help in reformatting the records of input file.

Eg:(INPUT FILE)
H01
A1
B1
A2
B2
A3
B3
H02
C1
D1
C2
D2
C3
D3

i NEED OUTPUT FILE AS
H01 A1 B1
H01 A2 B2
H01 A3 B3
H02 C1 D1
H02 C2 D2
H02 C3 D3

Hope i am clear in explaining my problem.
Please let me know if any other details are required

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

gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu May 12, 2011 5:21 pm    Post subject:
Reply with quote

Will the header will have 6 records under it? Is it fixed? Can the below scenario possible?

Eg:(INPUT FILE)
H01
A1
B1
A2
A3
B3
H02
C1
D1
C2
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu May 12, 2011 10:05 pm    Post subject:
Reply with quote

Quote:
Hope i am clear in explaining my problem.


Unfortunately, you're not clear.

Please show a better example of the records in each input file with all possible cases and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input file. If the input file can have duplicates within it, show that in your example.
Back to top
View user's profile Send private message
Pinchoo

New User


Joined: 22 Nov 2005
Posts: 8
Location: hyderabad

PostPosted: Thu May 19, 2011 11:09 am    Post subject: Reply to: Formatting the records of input file
Reply with quote

Both the input and output are FB flat files with rec length 80

there's a header rec at the top and below the header there are number of other records associated with the header. i want to prefix the header with every record.

EG.
Head1
Rec1
Rec2
Rec3
Rec4
Head2
Rec1
Rec2
Rec3
Head3
Rec1
Rec2

I need the output as"
Head1 Rec1
Head1 rec2
Head1 rec3
Head1 rec3
Head2 Rec1
Head2 Rec2
Head2 Rec3
Head3 Rec1
Head3 Rec2
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Thu May 19, 2011 11:39 am    Post subject:
Reply with quote

I think there is a typo error in the output

I need the output as"
Head1 Rec1
Head1 rec2
Head1 rec3
Head1 rec3 should be Head1 rec4
Head2 Rec1
Head2 Rec2
Head2 Rec3
Head3 Rec1
Head3 Rec2

Can you please clarify that the rec1, rec2 etc needs to be sorted ?
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1459
Location: Azeroth

PostPosted: Thu May 19, 2011 12:01 pm    Post subject:
Reply with quote

Hello,
Quote:
Eg:(INPUT FILE)
H01
A1
B1
A2
B2
A3
B3
H02
C1
D1
C2
D2
C3
D3

i NEED OUTPUT FILE AS
H01 A1 B1
H01 A2 B2
H01 A3 B3
H02 C1 D1
H02 C2 D2
H02 C3 D3


Quote:
EG.
Head1
Rec1
Rec2
Rec3
Rec4
Head2
Rec1
Rec2
Rec3
Head3
Rec1
Rec2

I need the output as"
Head1 Rec1
Head1 rec2
Head1 rec3
Head1 rec3
Head2 Rec1
Head2 Rec2
Head2 Rec3
Head3 Rec1
Head3 Rec2


Looks like the two requirements are different from two of your posts.
Which one you require?
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1459
Location: Azeroth

PostPosted: Thu May 19, 2011 12:16 pm    Post subject:
Reply with quote

Hello,
Quote:
EG.
Head1
Rec1
Rec2
Rec3
Rec4
Head2
Rec1
Rec2
Rec3
Head3
Rec1
Rec2

I need the output as"
Head1 Rec1
Head1 rec2
Head1 rec3
Head1 rec3
Head2 Rec1
Head2 Rec2
Head2 Rec3
Head3 Rec1
Head3 Rec2

If this is your requirement you could use the below sort card

Code:
   SORT FIELDS=COPY                                     
   INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,EQ,C'HEAD'),   
   PUSH=(81:1,5))                                       
   OUTFIL BUILD=(81,5,X,1,74),INCLUDE=(1,5,CH,NE,81,5,CH)


Hope it helps.
Back to top
View user's profile Send private message
Pinchoo

New User


Joined: 22 Nov 2005
Posts: 8
Location: hyderabad

PostPosted: Thu May 19, 2011 2:10 pm    Post subject:
Reply with quote

Thanks! a ton...
it worked perfect and resolved my issue..

Though i am still trying to understand it working line by line
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm


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