Hi,Level 49 is the last sub level and is used to declare identifiers for which we are not sure that what length they can occupy. For exapmle we have a filed NAME in our file and its length is 50 and we want that if name of a person is of 20 chars only, rest 30 chars positions could be reused than to leave the space unused.EX. Say our Rec is01 EMP-REC 05 EMPID PIC X(10). 05 DEPT PIC X(20). 49 NAME PIC X(50). 49 ADDRESS PIC X(50). And if NAME is 'PRADEEP' i.e. using only 7 chars out of allocated 50 then the next field ADDRESS will start right from where the NAME filed ends instead of leaving the 43 positions unused.All, Please advise me if I am wrong.pradeep
anil bidave
Feb 4th, 2007
it is used to define the db2 char in cobolas var char.
anil
Feb 4th, 2007
it is used to define the db2 char in cobolas var char.
Pradeep Bhatt
Feb 6th, 2007
Yes It is used for VARCHAR type in a Copybook for a DB2 table, but the logic is to implement the efficient space utilization which is provided in DB2 by VARCHAR against CHAR.
cvikrant
Feb 10th, 2007
It is last sub groups of elemenary items.
Irina K
Mar 24th, 2007
You "need" 49 levels to define host variables for VARCHAR cols in DB2. The 1st 49 contains the length of the string; the 2nd the string itself. To move the string you can use refmod or the STRING stmt, eg.:
PS It's the creator's responsibility to populate vf-len when vf-data is populated. When the data is written to the DB2 table it will only occupy as many bytes as the vf-len indicates even though the PIC of the host variable may be larger.
Also note that there is no "space" fill when the col is loaded into vf-data. If vf-data was 5 bytes and conained "AAAAA" then you loaded the col containing "BB" the result would be "BBAAA"
Although level 02-49 level are group or elementry elements but sometimes 49 are used for dynmic SQL, i.e. 01 WS-SQl-statement1-VARIABLE. 49 WS-SQL-STATEMENT1-LEN PIC S9(4). USAGE COMP. 49 WS-SQL-STATEMENT1-TXT PIC x(1000.
snehali
Apr 2nd, 2013
The level number 02 to 49 are use to specify the group and elementary data items within a record.
What is the use of Level 49 in COBOL?
Related Answered Questions
Related Open Questions