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

To remove Constant from Detail rec without changing HEADER


IBM Mainframe Forums -> HomeWorks & Requests
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Chidane

New User


Joined: 25 Nov 2021
Posts: 19
Location: India

PostPosted: Wed Jul 17, 2024 11:28 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2114
Location: USA

PostPosted: Wed Jul 17, 2024 11:47 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3073
Location: NYC,USA

PostPosted: Thu Jul 18, 2024 2:01 am
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1301
Location: Bamberg, Germany

PostPosted: Thu Jul 18, 2024 2:06 am
Reply with quote

It's the other way around, check IFTHEN is not a HDR/TRL then cut the record.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2114
Location: USA

PostPosted: Thu Jul 18, 2024 2:06 am
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3073
Location: NYC,USA

PostPosted: Thu Jul 18, 2024 2:08 am
Reply with quote

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
View user's profile Send private message
Chidane

New User


Joined: 25 Nov 2021
Posts: 19
Location: India

PostPosted: Mon Jul 29, 2024 3:14 pm
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1301
Location: Bamberg, Germany

PostPosted: Mon Jul 29, 2024 4:15 pm
Reply with quote

Please update us if your DSN is VB or FB. Thanks.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2114
Location: USA

PostPosted: Mon Jul 29, 2024 5:15 pm
Reply with quote

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
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 -> HomeWorks & Requests

 


Similar Topics
Topic Forum Replies
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts changing defaults in db2 admin - Unlo... DB2 0
No new posts Remove leading zeroes SYNCSORT 4
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts How to remove block of duplicates DFSORT/ICETOOL 8
Search our Forums:

Back to Top