IBM MAINFRAME HELP & SUPPORT FORUMS
Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

Difference between VALUE and INIT

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> PL/I & ASSEMBLER
View previous topic :: View next topic  
Author Message
MSMITHUK



Joined: 31 Mar 2005
Posts: 5

Posted: Mon Apr 24, 2006 8:41 pm    Post subject: Difference between VALUE and INIT  

I have read the Language Reference manual but am still not clear.
Can anyone help with an explanation of the difference between using INIT to set the value of a variable and using VALUE.
Thanks in advance,

M
Back to top  
sri.mainframes



Joined: 16 Feb 2006
Posts: 29
Location: MUMBAI

Posted: Thu Jun 22, 2006 3:57 pm    Post subject: Re: Difference between VALUE and INIT  

hi ,


init is used in pl/1 to assign the value to the variables
value is used in cobol to assign value to the variavles
in cobol initilize means numeric variables set to zeros
and character variables set to spaces

Regards
Prince
Back to top  
karnatikalyan



Joined: 08 Feb 2006
Posts: 5

Posted: Thu Jun 29, 2006 1:42 pm    Post subject: Re: Difference between VALUE and INIT  

Hi,

I can tell you with an example of char data type.

for char data type the default length is 1. But if you use VALUE, you can assign a string of length morethan 1

For example:-

DCL NAME CHAR INIT('N'); Here the defualt lengh of name is 1 so you can not assign any string that has a lengh morethan 1

But

DC NAME CHAR VALUE('ASDASDSDDASDASDAS'); Though the default lengh is 1, still NAME can be assigned with a string that has length morethan one. NAME can be assigned with any length of chars.

If you have better idea about this please let me know.

Regards,
Karnati kalyan.
Back to top  
MSMITHUK



Joined: 31 Mar 2005
Posts: 5

Posted: Thu Jun 29, 2006 3:09 pm    Post subject:  

I have also found that when using the keyword VALUE to initialise a variable then the contents of that variable can NOT be changed within the program.

Cheers,
Moira
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> PL/I & ASSEMBLER
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM