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

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


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
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
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Sep 14, 2012 7:13 pm
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: 1788
Location: Bloomington, IL

PostPosted: Fri Sep 14, 2012 8:46 pm
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
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: 1788
Location: Bloomington, IL

PostPosted: Fri Sep 14, 2012 10:40 pm
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
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: 1788
Location: Bloomington, IL

PostPosted: Fri Sep 14, 2012 11:22 pm
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

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Sat Sep 15, 2012 3:44 pm
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
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

Moderator Emeritus


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

PostPosted: Sun Sep 16, 2012 2:54 am
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

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Sun Sep 16, 2012 3:11 am
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Sep 17, 2012 10:21 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top