|
View previous topic :: View next topic
|
| Author |
Message |
prarthana
New User
Joined: 12 Mar 2006 Posts: 21
|
|
|
|
Hi,
I have a input file (record format is FB and record lenght is 756)
I have three Comp-3 fields coming in positions say 100, 120 and 140.I want to extract 11 characters .
So I have this in my JCL
OUTREC FIELDS=(1:120,6,PD,EDIT=(TTTTTTTTTTT))
I want to know how to extract comp 3 fields in position 120 and 140 .
Note: Comp3 field will definitely come in position 100..But may or may not come in positions 120 and 140. Need do check if positions 120 and 140 have values..If they do come in positions 120 and 140 I need to have them in the output.
Finally I want my output file(which is also FB) to have:
12345678904
53453453555
67568843244
(each of the Comp3 field should appear in a separate line)
Thanks |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
To get the three values in three records, you can use a DFSORT OUTFIL statement like this:
| Code: |
OUTFIL OUTREC=(100,6,PD,EDIT=(TTTTTTTTTTT),/,
120,6,PD,EDIT=(TTTTTTTTTTT),/,
140,6,PD,EDIT=(TTTTTTTTTTT))
|
But you also said
| Quote: |
| Comp3 field will definitely come in position 100..But may or may not come in positions 120 and 140. Need do check if positions 120 and 140 have values..If they do come in positions 120 and 140 I need to have them in the output. |
You need to explain what you mean by that. What does it mean for the field starting in position 120 or 140 to not have a value? Do you mean the field has a P'0' (PD value of 0), or binary zeros or blanks or what? It would really help if you would show the value you want to check for in hex. |
|
| Back to top |
|
 |
prarthana
New User
Joined: 12 Mar 2006 Posts: 21
|
|
|
|
Thanks for the reply Frank.
Yes, the field has the PD value of 0. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job that will do what you asked for:
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
* Edit PD values to ZD values in 1, 21 and 41.
INREC BUILD=(1:100,6,PD,EDIT=(TTTTTTTTTTT),
21:120,6,PD,EDIT=(TTTTTTTTTTT),
41:140,6,PD,EDIT=(TTTTTTTTTTT))
* If value in 21 not 0 and value in 41 not 0,
* write out 1, 21 and 41 values.
OUTFIL IFTHEN=(WHEN=(21,11,ZD,NE,0,AND,41,11,ZD,NE,0),
BUILD=(1,11,/,21,11,/,41,11)),
* If value in 21 not 0 and value in 41 is 0,
* write out 1 and 21 values.
IFTHEN=(WHEN=(21,11,ZD,NE,0,AND,41,11,ZD,EQ,0),
BUILD=(1,11,/,21,11)),
* If value in 21 is 0 and value in 41 not 0,
* write out 1 and 41 values.
IFTHEN=(WHEN=(21,11,ZD,EQ,0,AND,41,11,ZD,NE,0),
BUILD=(1,11,/,41,11)),
* If value in 21 is 0 and value in 41 is 0,
* write out 1 value.
IFTHEN=(WHEN=(21,11,ZD,EQ,0,AND,41,11,ZD,EQ,0),
BUILD=(1,11))
/*
|
|
|
| Back to top |
|
 |
prarthana
New User
Joined: 12 Mar 2006 Posts: 21
|
|
|
|
| Thank you Frank |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|