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
 

 

LENGTH(STRING(VARIABLE_NAME)

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

New User


Joined: 15 Nov 2005
Posts: 22

PostPosted: Wed Mar 01, 2006 7:37 pm    Post subject: LENGTH(STRING(VARIABLE_NAME)
Reply with quote

DCL CHNG_AGGR_LENGTH FIXED BIN(15) INIT(LENGTH(STRING(CHNG_AGGR)));

what is the o/p of the above statement and i want to know if we use combination pf LENGHT(STRING) what it means??

DCL 01 CHNG_AGGR BASED(DATA_PTR),
03 UPDATE CHAR(1),
03 IACT CHAR(5),
03 NEWTEXT CHAR(36);

DCL DATA_PTR PTR;

DATA_PTR = ADDR(GDSSOP_DATA(OUTPUT_POS));

DCL GDSSOP_DATA(4000) CHAR(1);
Back to top
View user's profile Send private message

acp_ajay1

New User


Joined: 13 Mar 2006
Posts: 9

PostPosted: Thu Apr 06, 2006 12:17 pm    Post subject: Re: LENGTH(STRING(VARIABLE_NAME)
Reply with quote

Hi nutakkimurali

DCL CHNG_AGGR_LENGTH FIXED BIN(15) INIT(LENGTH(STRING(CHNG_AGGR)));

what is the o/p of the above statement and i want to know if we use combination pf LENGHT(STRING) what it means??


Well dear, the statement Length(String) would give u the length of the string.

In PLI if u don't declare a string as varying then length function will return u the total length which u had given at the time of declaration of string.

i mean if u write "dcl abc char(15)" and "abc ='abc'" then even though length is 3, length function will return u length 15, so use varying option when u declare a string.

The statement DCL CHNG_AGGR_LENGTH FIXED BIN(15) INIT(LENGTH(STRING(CHNG_AGGR))); should return the output as 15.

Ajay.
Back to top
View user's profile Send private message
acp_ajay1

New User


Joined: 13 Mar 2006
Posts: 9

PostPosted: Thu Apr 06, 2006 2:27 pm    Post subject: Re: LENGTH(STRING(VARIABLE_NAME)
Reply with quote

Hi nutakkimurali,

Sorry but the statement

DCL CHNG_AGGR_LENGTH FIXED BIN(15) INIT(LENGTH(STRING(CHNG_AGGR)));

won't work and the compiler won't allow u to go ahead. Along with string function u can only have arguments having bit values or characters.

Ajay
Back to top
View user's profile Send private message
banu

New User


Joined: 09 Aug 2005
Posts: 8
Location: Chennai

PostPosted: Wed May 24, 2006 10:24 am    Post subject: Re: LENGTH(STRING(VARIABLE_NAME)
Reply with quote

DCL CHNG_AGGR_LENGTH FIXED BIN(15) INIT(LENGTH(STRING(CHNG_AGGR)));

what is the o/p of the above statement and i want to know if we use combination pf LENGHT(STRING) what it means??

=> This will work. And if you try to display the variable CHNG_AGGR_LENGTH, the ans would be 42.
But if you observe, the value assigned to 'CHNG_AGGR' would be of length 1.
=>
If CHNG_ADDR is declared as a variable of say Char (12),

Then you need not have to use 'Length(string(chng_addr))'.. Instead you could use 'Length(Chng_addr)' itself.

=>
But in your example, you have declared that variable as structure,
Hence u require the built - in function 'STRING'.


Hope this clears your doubt..
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 SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm


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