|
View previous topic :: View next topic
|
| Author |
Message |
Sathish Gurumoorthy
New User
Joined: 12 Feb 2009 Posts: 33 Location: Chennai, India
|
|
|
|
Hi,
I have an input file of length 80 & recfm = FB like below.
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
PROD1 FIGARO FIG0 PPS716 COBOLFIG P COBOLACD G974616 01 01
PROD1 FIGARO FIG0 PPS740 COBOLFIG P COBOLACD G470203 01 10
PROD1 FIGARO FIG0 PPS741 COBOLFIG P COBOLACD 01 01
PROD1 FIGARO FIG0 PPS742 COBOLFIG P COBOLACD 01 02
PROD1 FIGARO FIG0 PPS745 COBOLFIG P COBOLACD 01 00
PROD1 FIGARO FIG0 PPS746 COBOLFIG P COBOLACD G974650 01 01
DEVF1 FIGARO FIG1 PSS716 COBOLFIG E COBOLOCD G270214 01 00
DEVF1 FIGARO FIG1 PSS742 COBOLFIG E COBOLOCD G973013 01 00
DEVF1 FIGARO FIG1 PSS746 COBOLFIG E COBOLOCD 01 00 |
When i use below splice, i get the below output file which has length 80 & FB.
| Code: |
SPLICE FROM(IN) TO(OUT) ON(19,10) ON(30,8) -
WITHANY WITH(1,5) WITH(7,6) WITH(14,4) WITH(39,1) WITH(41,8) WITH(50,7) WITH(61,2) WITH(65,2)
Output file
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
DEVF1 FIGARO FIG1 PSS716 COBOLFIG E COBOLOCD G270214 01 01 00
DEVF1 FIGARO FIG1 PSS742 COBOLFIG E COBOLOCD G973013 01 02 00
DEVF1 FIGARO FIG1 PSS746 COBOLFIG E COBOLOCD G974650 01 01 00
|
But i want the output file as below. When Overlay record(DEVF1) in position 50 to 57 is spaces, the base record gets overlayed.
| Code: |
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
DEVF1 FIGARO FIG1 PSS716 COBOLFIG E COBOLOCD G270214 01 01 00
DEVF1 FIGARO FIG1 PSS742 COBOLFIG E COBOLOCD G973013 01 02 00
DEVF1 FIGARO FIG1 PSS746 COBOLFIG E COBOLOCD 01 01 00 |
look 3rd record in positions 50 to 57 in expected output file.
If WITH field in overlay record is spaces, then WITH field from base record is written into output file. I want WITH field from overlay record to be written.
I want all the fields from overlay records (DEVF1 records) except ON fields
Regards,
Sathish. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You need to do a better job of explaining what you want to do.
When do you want a field from the base record and when do you want a field from the overlay record. What about these cases:
1) field in base record and overlay record are nonblank
2) field in base record is blank and field in overlay record is nonblank
3) field in base record is nonblank and field in overlay record is blank
Which cases apply to which fields? Is it just the field in 50-57 that you want to handle in a special way or all of the WITH fields?
Please show a better example of input and expected output with all of the possible cases you want to handle. Explain the rules for getting from input to output. |
|
| Back to top |
|
 |
Sathish Gurumoorthy
New User
Joined: 12 Feb 2009 Posts: 33 Location: Chennai, India
|
|
|
|
Hi Frank,
I want only the fields from Overlay record irrespective of blanks or nonblanks in Base record as well as Overlay record.
This applies to all the WITH fields except ON fields.
Below is the sample input and expexted output.
| Code: |
Input file
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
PROD1 FIGARO FIG0 PPS745 COBOLFIG P COBOLACD 01 08
PROD1 FIGARO FIG0 PPS746 COBOLFIG P COBOLACD G974650 01 05
DEVF1 FIGARO FIG1 PSS745 COBOLFIG E COBOLOCD G974606 01 04
DEVF1 FIGARO FIG1 PSS746 COBOLFIG E COBOLOCD 01 02
Expected output
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
DEVF1 FIGARO FIG1 PSS745 COBOLFIG E COBOLOCD G974606 01 08 04
DEVF1 FIGARO FIG1 PSS746 COBOLFIG E COBOLOCD 01 05 02
|
Hope this clears.
Regards,
Sathish. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Quote: |
want only the fields from Overlay record irrespective of blanks or nonblanks in Base record as well as Overlay record.
This applies to all the WITH fields except ON fields. |
But in your output example you show 61-62 containing the field from the base record rather than from the overlay record. Was this a mistake? Would you really want blanks in 61-62 (as in the overlay record)? If not, what is the rule for that?
Also, for ON(19,10,CH), you have PPS fields in one case and PSS fields in the other case, so they won't match.
So I'm not sure what you really want, but try removing WITHANY and see if that does it. If not, explain more carefully what you want to do with an example that makes sense. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|