Hi,
I have working storage variable WS-WEB-LINK pic X(150).
And after i read my SYSFILE , I am moving the values from SYS-WEB-LINK variable to WS-WEB-LINK variable. Just note SYS-WEB-LINK also declared pic X(150) in copy book,.
Now, i wanted to ignore all spaces in WS-WEB-LINK and move the ONLY values to WS-FINAL-LINK.(without spaces) using STRING statement. I did that. that is okay.
WS-FINAL-LINK we will not know how variable size either 60 or 70 or 90 size.,.. But, maximum i declared as 150 bytes . that is okay,
My question is here, I just wanted to know how do i declare the size to WS-FINAL-LINK based on Inspect counter value at the run time using Acu GT cobol software.
That is reason i am saying Acu GT cobol do not give build the logic now..
Any clue please? This is urgent request from my side....thank you in advance.,
Hi,
I have working storage variable WS-WEB-LINK pic X(150).
And after i read my SYSFILE , I am moving the values from SYS-WEB-LINK variable to WS-WEB-LINK variable. Just note SYS-WEB-LINK also declared pic X(150) in copy book,.
Now, i wanted to ignore all spaces in WS-WEB-LINK and move the ONLY values to WS-FINAL-LINK.(without spaces) using STRING statement. I did that. that is okay.
WS-FINAL-LINK we will not know how variable size either 60 or 70 or 90 size.,.. But, maximum i declared as 150 bytes . that is okay,
My question is here, I just wanted to know how do i declare the size to WS-FINAL-LINK based on Inspect counter value at the run time using Acu GT cobol software.
That is reason i am saying Acu GT cobol do not give build the logic now..
Any clue please? This is urgent request from my side....thank you in advance.,
Hi Joseph.
May I ask why do you need to declare the WS-FINAL-LINK variable with the right size?
Can't you just:
- Define WS-FINAL-LINK variable as PIC X(150)
- Count how many chars are stored in that variable and save it in another variable, for example WS-SIZE
- When you need to use the "sized variable", use the syntax WS-FINAL-LINK(1:WS-SIZE)
If you can't use this syntax, can you tell us where do you have to use the WS-FINAL-LINK variable and why it can't work?
Hi Joseph.
May I ask why do you need to declare the WS-FINAL-LINK variable with the right size?
Can't you just:
- Define WS-FINAL-LINK variable as PIC X(150)
- Count how many chars are stored in that variable and save it in another variable, for example WS-SIZE
- When you need to use the "sized variable", use the syntax WS-FINAL-LINK(1:WS-SIZE)
If you can't use this syntax, can you tell us where do you have to use the WS-FINAL-LINK variable and why it can't work?
Hello , Thanks for your quick response.
Hi Joseph.
May I ask why do you need to declare the WS-FINAL-LINK variable with the right size?
My answer - Yes, I should keep size as X(150)
Can't you just:
- Define WS-FINAL-LINK variable as PIC X(150)
- Count how many chars are stored in that variable and save it in another variable, for example WS-SIZE
- When you need to use the "sized variable", use the syntax WS-FINAL-LINK(1:WS-SIZE)
My answer- WS-SIZE i can do reference modification. Yes, But, if i get to know runtime variable declaration, more helpful to fulfill my customer requirement. I will need it for many purpose.
If you can't use this syntax, can you tell us where do you have to use the WS-FINAL-LINK variable and why it can't work?
My answer- I declared like 01 WS-FINAL-LINK X(150)
Hello , Thanks for your quick response.
Hi Joseph.
May I ask why do you need to declare the WS-FINAL-LINK variable with the right size?
My answer - Yes, I should keep size as X(150)
Can't you just:
- Define WS-FINAL-LINK variable as PIC X(150)
- Count how many chars are stored in that variable and save it in another variable, for example WS-SIZE
- When you need to use the "sized variable", use the syntax WS-FINAL-LINK(1:WS-SIZE)
My answer- WS-SIZE i can do reference modification. Yes, But, if i get to know runtime variable declaration, more helpful to fulfill my customer requirement. I will need it for many purpose.
If you can't use this syntax, can you tell us where do you have to use the WS-FINAL-LINK variable and why it can't work?
My answer- I declared like 01 WS-FINAL-LINK X(150)
Well, if you can't use the (1:size) syntax I can suggest you to take a look at the M$ALLOC.
It is not so comfortable to use, but you can directly manage the memory...
Well, if you can't use the (1:size) syntax I can suggest you to take a look at the M$ALLOC.
It is not so comfortable to use, but you can directly manage the memory...
Ok Thanks. Can you please brief about M$ALLOC
Any link please to study?
Ok Thanks. Can you please brief about M$ALLOC
Any link please to study?
Any simple sample program to understand about M$ALLOC please?
What disadvantage on this?
Any simple sample program to understand about M$ALLOC please?
What disadvantage on this?
CALL "M$ALLOC"
USING ITEM-SIZE, MEM-ADDRESSdo i need to declare MEM-ADDRESS in working storage section.? what size ?
CALL "M$ALLOC"
USING ITEM-SIZE, MEM-ADDRESSdo i need to declare MEM-ADDRESS in working storage section.? what size ?
when i use "M$ALLOC" in my program, it gives below error. Pleas note I am using Acubench to compile/run program.
Invalid or missing parameter to "M$ALLOC"
when i use "M$ALLOC" in my program, it gives below error. Pleas note I am using Acubench to compile/run program.
Invalid or missing parameter to "M$ALLOC"
Hi
M$ALLOC allows you to directly work with the memory. In this way, you can decide how many data store in this memory at runtime.
Main disadvantages are:
- It is a low-level rout, so you have to manually release the memory with M$FREE routine
- It is not so easy to use as common variables, since you have to get/put/copy memory with specific routines (M$GET, M$PUT, M$COPY)
But in this way, you can use any desired size.
Honestly, I still don't understand what your customer ask and why can't you use the "(1:SIZE)" syntax, but if it doesn't work, the only way I know is to manage the memory directly from M$ALLOC
About your question, I don't have any example since I used it only once in my life. In any way, this is the link where you can find the documentation of the M$ALLOC routine and all other related stuff: https://www.microfocus.com/documentation/extend-acucobol/103/extend-Interoperability-Suite/BKPPPPLIBRS136.html
With M$ALLOC you have to pass two parameters: size (working storage variable or a number) and the pointer to the memory, defined in working storage as "USAGE HANDLE".
All other call to the memory (M$GET, M$PUT, ...) are done with this HANDLE that is the pointer to the allocated memory.
Pay attention to always call the right M$FREE for each call to the M$ALLOC, or nobody will release the allocated memory
Hi,
I have working storage variable WS-WEB-LINK pic X(150).
And after i read my SYSFILE , I am moving the values from SYS-WEB-LINK variable to WS-WEB-LINK variable. Just note SYS-WEB-LINK also declared pic X(150) in copy book,.
Now, i wanted to ignore all spaces in WS-WEB-LINK and move the ONLY values to WS-FINAL-LINK.(without spaces) using STRING statement. I did that. that is okay.
WS-FINAL-LINK we will not know how variable size either 60 or 70 or 90 size.,.. But, maximum i declared as 150 bytes . that is okay,
My question is here, I just wanted to know how do i declare the size to WS-FINAL-LINK based on Inspect counter value at the run time using Acu GT cobol software.
That is reason i am saying Acu GT cobol do not give build the logic now..
Any clue please? This is urgent request from my side....thank you in advance.,
you can use STRING with a POINTER to automatically count the characters moved:
WORKING-STORAGE SECTION.
01 SOURCE-STRING PIC X(50) VALUE NULL.
01 STR-PTR PIC 9(3).
PROCEDURE DIVISION.
MOVE 1 TO STR-PTR
STRING " The length of string "
INTO SOURCE-STRING
POINTER STR-PTR
SUBTRACT 1 FROM STR-PTR
STR-PTR will contain the length of the actual string. Note that STR-PTR must be explicitly set to 1 before using the STRING command.
you can use STRING with a POINTER to automatically count the characters moved:
WORKING-STORAGE SECTION.
01 SOURCE-STRING PIC X(50) VALUE NULL.
01 STR-PTR PIC 9(3).
PROCEDURE DIVISION.
MOVE 1 TO STR-PTR
STRING " The length of string "
INTO SOURCE-STRING
POINTER STR-PTR
SUBTRACT 1 FROM STR-PTR
STR-PTR will contain the length of the actual string. Note that STR-PTR must be explicitly set to 1 before using the STRING command.
Great! Thanks for your solution, it worked.