|
View previous topic :: View next topic
|
| Author |
Message |
Chidane
New User
Joined: 25 Nov 2021 Posts: 34 Location: India
|
|
|
|
Hi Team.
I have below data in file of record length 25 bytes.
I would like to remove the constant character 'ABCDE' from Detail record reducing the overall file length from 25 byte to 20 byte but would like to keep the HEADER and 9TRAIL as such
| Code: |
HEADERABCDEBRIDGE
ABCDERAJUACCOUNTS MANAGER
ABCDEREMAACCOUNTS MANAGER
9TRAILRABCDEBRIDGE |
Output looks like
| Code: |
HEADERABCDEBRIDGE
RAJUACCOUNTS MANAGER
REMAACCOUNTS MANAGER
9TRAILRABCDEBRIDGE |
Can you please help ?
Thanks |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2290 Location: USA
|
|
|
|
It's only possible with RECFM=VB
Standard question for newcomers: What did you try so far?
Try to do it STEP-BY-STEP.
First, ignore your requirement on leaving untouched header and footer, and train yourself: how to remove a part of a record, without truncation of physical LRECL?
Next, train yourself: how to truncate the physical record length after removing its part?
Finally, find out: how to leave your header and footer untouched?
Never try to resolve any complex task in one shot!!!
Never ask others to do your own job for you, from start to finish!!! |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3112 Location: NYC,USA
|
|
|
|
Why VB ? If it’s FB 25 then on the way out just build for FB 20..
There are many easy way to solve this but one that I can say -
If it’s always first five positions then use IFTHEN CONDITION to check if it’s’ABCDE’ then BUILD ONLY FROM 6,20 otherwise BUILD (1,20)..
Wouldn’t that work ? |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1448 Location: Bamberg, Germany
|
|
|
|
| It's the other way around, check IFTHEN is not a HDR/TRL then cut the record. |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2290 Location: USA
|
|
|
|
| Rohit Umarjikar wrote: |
Why VB ? If it’s FB 25 then on the way out just build for FB 20..
There are many easy way to solve this but one that I can say -
If it’s always first five positions then use IFTHEN CONDITION to check if it’s’ABCDE’ then BUILD ONLY FROM 6,20 otherwise BUILD (1,20)..
Wouldn’t that work ? |
The header and trailer must remain 25 characters, isn’t it?
Besides, after removing 5 chars from a record I expect not to append 5 blanks at the end of updated record, but make it exactly 20 bytes long. |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3112 Location: NYC,USA
|
|
|
|
| sergeyken wrote: |
| Rohit Umarjikar wrote: |
Why VB ? If it’s FB 25 then on the way out just build for FB 20..
There are many easy way to solve this but one that I can say -
If it’s always first five positions then use IFTHEN CONDITION to check if it’s’ABCDE’ then BUILD ONLY FROM 6,20 otherwise BUILD (1,20)..
Wouldn’t that work ? |
The header and trailer must remain 25 characters, isn’t it? |
No . All records should get cut down to 20 bytes.. that’s what TS expects and that’s my interpretation to it .
Btw moved this post to beginners section . |
|
| Back to top |
|
 |
Chidane
New User
Joined: 25 Nov 2021 Posts: 34 Location: India
|
|
|
|
Yes, the total file length should be 20 bytes.
We can see that the Header and Trailer comes within this 20 byte length and so no issues.
I have tried like this and it works but got puzzled how it works.
if I remove the last stetement IFTRAIL=(HD=YES,TRLID=(1,6,CH,EQ,C'9TRAIL')) , the Header gets truncated
OUTFILE FNAMES=OUTPUT1,OUTREC=(6,20),
INCLUDE=(1,5,CH,EQ,C' HEAD',OR,1,5,CH,EQ,C'ABCDE',OR,
1,5,CH,EQ,C'9TRAI'),
IFTRAIL=(HD=YES,TRLID=(1,6,CH,EQ,C'9TRAIL')) |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1448 Location: Bamberg, Germany
|
|
|
|
| Please update us if your DSN is VB or FB. Thanks. |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2290 Location: USA
|
|
|
|
Please!!! Learn how to use the Code button.
| Chidane wrote: |
Yes, the total file length should be 20 bytes.
We can see that the Header and Trailer comes within this 20 byte length and so no issues.
I have tried like this and it works but got puzzled how it works.
if I remove the last stetement
| Code: |
| IFTRAIL=(HD=YES,TRLID=(1,6,CH,EQ,C'9TRAIL')) |
the Header gets truncated
| Code: |
OUTFILE FNAMES=OUTPUT1,OUTREC=(6,20),
INCLUDE=(1,5,CH,EQ,C' HEAD',OR,1,5,CH,EQ,C'ABCDE',OR,
1,5,CH,EQ,C'9TRAI'),
IFTRAIL=(HD=YES,TRLID=(1,6,CH,EQ,C'9TRAIL')) |
|
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|