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

LENGTH(STRING(VARIABLE_NAME)


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
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
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
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
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
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 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 Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top