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

Formatting the records of input file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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 Developer


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

PostPosted: Thu May 12, 2011 10:05 pm
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
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
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: 1742
Location: Tirupur, India

PostPosted: Thu May 19, 2011 12:01 pm
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: 1742
Location: Tirupur, India

PostPosted: Thu May 19, 2011 12:16 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top