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
 

 

How can we compress char length in PL1?

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

New User


Joined: 18 Oct 2005
Posts: 5

PostPosted: Wed Nov 23, 2005 6:49 pm    Post subject: How can we compress char length in PL1?
Reply with quote

Hi,

Can anyone convert char(3) into char(2) in PL1 just like Comp3 in Cobol?


Surendra
Back to top
View user's profile Send private message

karthik srinivasan

New User


Joined: 07 Oct 2005
Posts: 6
Location: chennai

PostPosted: Wed Nov 23, 2005 7:32 pm    Post subject: Re: How can we compress char length in PL1?
Reply with quote

HI Surendra,

I am not sure of compressing technique in PL1 , but for the situtation which u are facing you can declare the variable as

DCL ABC CHAR(2) VARYING

when a variable is declared as varying, the srorage allocation for the variable is 2 + 2 bytes ( in extra).

I hope this helps

Thanks
Karthik Srinivasan
Back to top
View user's profile Send private message
surendra_mainframe

New User


Joined: 18 Oct 2005
Posts: 5

PostPosted: Wed Nov 23, 2005 8:02 pm    Post subject: Thanx Karthik
Reply with quote

But still when i am doing char(2) = char(3) , result of char(2) variable is truncating the data.
Back to top
View user's profile Send private message
k_vikram07

New User


Joined: 23 Nov 2005
Posts: 35

PostPosted: Wed Nov 23, 2005 8:17 pm    Post subject:
Reply with quote

I don't think we can do this in any language either in Cobol or PL1.

The cobol comp-3 is not for char. it is for numeric.

We do have such a thing for numeric items in Pl1. But not for Char.

You may however raise a condition to stop this truncation if it ever happens.


Thanks
Vik.
Back to top
View user's profile Send private message
nutakkimurali

New User


Joined: 15 Nov 2005
Posts: 22

PostPosted: Fri Nov 25, 2005 11:55 am    Post subject: Re: How can we compress char length in PL1?
Reply with quote

Hi karthi,

Why it allocates 2+2 when u dec the 2 bytes variable with varying option

Please let me know

DCL ABC CHAR(2) VARYING

when a variable is declared as varying, the srorage allocation for the variable is 2 + 2 bytes ( in extra).

Muralee
Back to top
View user's profile Send private message
karthik srinivasan

New User


Joined: 07 Oct 2005
Posts: 6
Location: chennai

PostPosted: Fri Nov 25, 2005 2:20 pm    Post subject: Re: How can we compress char length in PL1?
Reply with quote

HI Murali...

The two bytes which is being added is for storing the length of the string.
THE LEFT MOST 2 BYTES CONTAIN THE LENGTH OF THE STRING

ie) 2 bytes ( this is for char(2) ) + 2 bytes ( this is for storing the length )

Hope this helps.....

Thanks & Regards
Karthik Srinivasan
Back to top
View user's profile Send private message
nutakkimurali

New User


Joined: 15 Nov 2005
Posts: 22

PostPosted: Fri Nov 25, 2005 3:47 pm    Post subject: Re: How can we compress char length in PL1?
Reply with quote

Karthik Thank you for your input

Muralee
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 Viewing executing process in NDM .. q... Debb.Brant IBM Tools 0 Wed Dec 14, 2016 10:55 pm
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Not able to compress a very large PDS Hervey Martinez JCL & VSAM 7 Fri Nov 04, 2016 5:57 pm
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am


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