|
|
| Author |
Message |
Parthasarathy
New User
Joined: 24 Feb 2006 Posts: 13 Location: Chennai
|
|
|
|
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 |
|
 |
References
|
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 5978 Location: San Jose, CA
|
|
|
|
| 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 |
|
 |
Parthasarathy
New User
Joined: 24 Feb 2006 Posts: 13 Location: Chennai
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 5978 Location: San Jose, CA
|
|
|
|
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 |
|
 |
|
|
|