Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Trim Command For Variable Lenght Record File , For PL/1.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
Parvinder Singh

New User


Joined: 06 Sep 2011
Posts: 6
Location: india

PostPosted: Fri Sep 14, 2012 6:57 pm    Post subject: Trim Command For Variable Lenght Record File , For PL/1.
Reply with quote

Hi,

I have a varialbe record lenght file , i want to trim the trailing spaces for the records , do we have any function available in PL/1 which trims the trailing spaces? Function 'TRIM' is availble in E-PL/1 any similr kind of function in PL/1 for vaiable records?
Back to top
View user's profile Send private message

Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Fri Sep 14, 2012 7:13 pm    Post subject: Reply to: Trim Command For Variable Lenght Record File , For
Reply with quote

Maybe a backwards "DO" loop, using SUBSTR until the 'nth' byte does not equal a space?

There are more advanced PL/I folks around so perhaps, wait for their replies.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri Sep 14, 2012 8:46 pm    Post subject: Re: Trim Command For Variable Lenght Record File , For PL/1.
Reply with quote

Parvinder Singh wrote:
Hi,

I have a varialbe record lenght file , i want to trim the trailing spaces for the records , do we have any function available in PL/1 which trims the trailing spaces? Function 'TRIM' is availble in E-PL/1 any similr kind of function in PL/1 for vaiable records?

What compiler are you using? Version number, please.
Back to top
View user's profile Send private message
Parvinder Singh

New User


Joined: 06 Sep 2011
Posts: 6
Location: india

PostPosted: Fri Sep 14, 2012 9:21 pm    Post subject:
Reply with quote

Hi,

Ther PL/1 compiler is Ver 1 Rel 1 Mod 1.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri Sep 14, 2012 10:40 pm    Post subject:
Reply with quote

Hmmm. For MVS V1.1.1, I can't think of a better suggestion than Mr. O'Boyle's, although Mr. Prins might be able to do so. I do, however, suggest that your shop seriously consider upgrading; that compiler has been out of support for about three years.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Sep 14, 2012 11:16 pm    Post subject:
Reply with quote

this trimming also adjust the vli (record length indicator)
and rewrite the record.

all this trimming of trailing spaces...why is it?
are they not part of the last field?
are they being added due to poor/bad/incorrect ftp commands?

i have never seen the need to remove the trailing spaces.
and please, do not give me any crap about saving dasd.
either the spaces belong,
or they were incorrectly added during the creation of the file.
fix the creation process.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri Sep 14, 2012 11:22 pm    Post subject:
Reply with quote

I had assumed, perhaps incorrectly, that his situation was about like this;
Code:
dcl (this, that) char (8),
    the_other_thing char (64),
    record char (80) var;
        :
        :
record = trim(this || that || the_other_thing);
write file (foo) from (record);
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Sat Sep 15, 2012 3:44 pm    Post subject:
Reply with quote

Akatsukami wrote:
I had assumed, perhaps incorrectly, that his situation was about like this;
Code:
dcl (this, that) char (8),
    the_other_thing char (64),
    record char (80) var;
        :
        :
record = trim(this || that || the_other_thing);
write file (foo) from (record);

That's most likely the scenario, and if we're dealing with really long records (XML?, VB 27994), the savings of trimming the training spaces may be significant.

Sadly, as you are using a version of PL/I that is well past its sell-by date, only Bill's solution would be possible, but it would, if the records are long and there can be large amounts of blanks, use CPU like there is no tomorrow, and there is very little you can do about this, unless you are willing to go for rather esoteric tricks like overlaying the string with an array of FIXED BIN (31)'s and checking those for 1,077,952,576, which would give you a four-fold increase in speed.
Back to top
View user's profile Send private message
Parvinder Singh

New User


Joined: 06 Sep 2011
Posts: 6
Location: india

PostPosted: Sat Sep 15, 2012 9:59 pm    Post subject:
Reply with quote

Hi Prino,

Yes, I am dealing with really long XML records :-) (VB,30000).

I will use Bill's solution and will work with project team and will definetly try to see if we can upgrade the compiler version.

@all ,Thanks a lot for your valuable time and suggestions.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Sep 16, 2012 2:54 am    Post subject:
Reply with quote

Hello,

When the cpu needed to support this is unacceptable, you need to understand and try the method Prino provided.
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Sun Sep 16, 2012 3:11 am    Post subject:
Reply with quote

There is an even "better" and more esoteric method, but to know if that can be used, you need to tell us how many records you are producing and the average length of those records.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Mon Sep 17, 2012 10:21 pm    Post subject: Reply to: Trim Command For Variable Lenght Record File , For
Reply with quote

If CPU is a problem for Bill's method, wouldn't it be a problem for any "trim" as well?

Isn't an LRECL of 30000 a bit wasteful in itself? Leaving 26000 bytes per track unused.

Isn't the best answer going to be for the creator of the data not to put the trailing blanks on?

Are your records fixed-length? And you want variable? If yes, you could, as an interim, put it through a Sort step, FTOV with VLTRIM.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us