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

Splitting a record into multiple records using the key value


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

New User


Joined: 24 Feb 2006
Posts: 18
Location: Chennai

PostPosted: Fri Jul 03, 2009 12:47 pm
Reply with quote

Hi,

I have the following input file of lrecl 451 and recfm VB

The first byte will have value from 0 to 9. Based on the value of first byte, the record length will vary.

If the first byte is 0, then the recl is 1; if 1 then recl is 51; if 2 recl is 101; if 3 recl is 151 ... if 9 recl is 451. (In simple words, the first byte identifies the number of occurences in the record)

Now my requirement is if first byte is 0, do not write the record to output. If first byte is 1, write one record to output from 2 to 51 bytes from input.
If first byte is 2, write two records to output from 2 to 51 bytes as 1 record and 52 to 101 as second record from input and so on.
My output will have lrecl 50 and recfm FB

Can you please tell me whether it's possible using DFSORT and if yes, the solution please
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: Fri Jul 03, 2009 7:59 pm
Reply with quote

Quote:
I have the following input file of lrecl 451 and recfm VB

If the first byte is 0, then the recl is 1; if 1 then recl is 51


Which type of 0? C'0', X'00', something else?

Your description of the records does not match your statement that the RECFM is VB. A VB record has a 4-byte RDW, so the minimum LRECL and record length is 5, not 1. The LRECL must be large enough to contain the largest record.

Do you really mean:

If the fifth byte is 0, then the record length is 5; if 1 then record length is 55?

Or does your input file actually have RECFM=FB?

You can do what you want with DFSORT either way, but I need to know what your input file really looks like to give you the correct solution.

Note that for technical discussions, it's important to use the correct terminology so people understand what you mean.
Back to top
View user's profile Send private message
Parthasarathy

New User


Joined: 24 Feb 2006
Posts: 18
Location: Chennai

PostPosted: Mon Jul 06, 2009 10:48 am
Reply with quote

Hi Yaeger,

I need the soultion for the following scenario as my input file is VB (Apologies for the confusion). And the zero is of type C'0'.

Quote:
Do you really mean:

If the fifth byte is 0, then the record length is 5; if 1 then record length is 55?
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: Mon Jul 06, 2009 9:50 pm
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file (VB/455)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (FB/50)
//TOOLIN   DD    *
COPY FROM(IN) USING(CTL1)
COPY FROM(T1) USING(CTL2)
/*
//CTL1CNTL DD *
  OMIT COND=(5,1,CH,EQ,C'0')
  OUTFIL FNAMES=T1,VTOF,BUILD=(5,451)
/*
//CTL2CNTL DD *
  OUTFIL FNAMES=OUT,IFOUTLEN=50,
   IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),
    BUILD=(2,50)),
   IFTHEN=(WHEN=(1,1,CH,EQ,C'2'),
    BUILD=(2,50,/,52,50)),
   IFTHEN=(WHEN=(1,1,CH,EQ,C'3'),
    BUILD=(2,50,/,52,50,/,102,50)),
   IFTHEN=(WHEN=(1,1,CH,EQ,C'4'),
    BUILD=(2,50,/,52,50,/,102,50,/,152,50)),
   IFTHEN=(WHEN=(1,1,CH,EQ,C'5'),
    BUILD=(2,50,/,52,50,/,102,50,/,152,50,/,
           202,50)),
   IFTHEN=(WHEN=(1,1,CH,EQ,C'6'),
    BUILD=(2,50,/,52,50,/,102,50,/,152,50,/,
           202,50,/,252,50)),
   IFTHEN=(WHEN=(1,1,CH,EQ,C'7'),
    BUILD=(2,50,/,52,50,/,102,50,/,152,50,/,
           202,50,/,252,50,/,302,50)),
   IFTHEN=(WHEN=(1,1,CH,EQ,C'8'),
    BUILD=(2,50,/,52,50,/,102,50,/,152,50,/,
           202,50,/,252,50,/,302,50,/,352,50)),
   IFTHEN=(WHEN=(1,1,CH,EQ,C'9'),
    BUILD=(2,50,/,52,50,/,102,50,/,152,50,/,
           202,50,/,252,50,/,302,50,/,352,50,/402,50))
/*
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top