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

How can we compress char length in PL1?


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
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
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
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts VB to VB copy - Full length reached SYNCSORT 8
Search our Forums:

Back to Top