Is there any difference between these tho statements?
CALL "CBL_CHANGE_DIR" using "\\CONT"
returning ID-STAT
CALL "CBL_CHANGE_DIR" using "\\CONT\\ "
returning ID-STAT
In the second case the name of the directory (in the root) is followed by \\ but I learned, that both statements should do the same. I observed that executing the first statement only once in the program, it works, but the second time no more, returning a status of 9 x”0d” file not found. Putting the \\ after the directory name apparently everything works, also executing the statement several times.. But it sounds very unusual, that the \\ makes the difference.
Can anybody explain me, if the trailing \\ is obligatory if the statement shall be executed several times?
Thanks
Rolf
According to the docs, the directory name should be terminated by a space or a null character which you are not doing in your example.
What product version and wrappack level are you using?
I just ran a test with NX 5.1 wrappack 11 and I can call the routine multiple times either with the trailing "\\" or without it and get a status of 0 returned.
Can you try running the following and see if you get the same results?
id division.
program-id. testit.
working-storage section.
01 id-stat pic x(4) comp-5 value 0.
procedure division.
call "CBL_CHANGE_DIR" using "\\TEMP "
returning id-stat
display id-stat
call "CBL_CHANGE_DIR" using "\\TEMP "
returning id-stat
display id-stat
call "CBL_CHANGE_DIR" using "\\TEMP\\ "
returning id-stat
display id-stat
call "CBL_CHANGE_DIR" using "\\TEMP\\ "
returning id-stat
display id-stat
goback.
Is there any difference between these tho statements?
CALL "CBL_CHANGE_DIR" using "\\CONT"
returning ID-STAT
CALL "CBL_CHANGE_DIR" using "\\CONT\\ "
returning ID-STAT
In the second case the name of the directory (in the root) is followed by \\ but I learned, that both statements should do the same. I observed that executing the first statement only once in the program, it works, but the second time no more, returning a status of 9 x”0d” file not found. Putting the \\ after the directory name apparently everything works, also executing the statement several times.. But it sounds very unusual, that the \\ makes the difference.
Can anybody explain me, if the trailing \\ is obligatory if the statement shall be executed several times?
Thanks
Rolf
You are right.
I supposed, as with normal variables, that COBOL fills out the field with spaces.
In this case not. It is mandatory to put "\\TEMP " followed by a space or the \\ or using "\\TEMP" & x"00"
but not "\\temp" without anything after the "p"
Thank you.
Rolf
Is there any difference between these tho statements?
CALL "CBL_CHANGE_DIR" using "\\CONT"
returning ID-STAT
CALL "CBL_CHANGE_DIR" using "\\CONT\\ "
returning ID-STAT
In the second case the name of the directory (in the root) is followed by \\ but I learned, that both statements should do the same. I observed that executing the first statement only once in the program, it works, but the second time no more, returning a status of 9 x”0d” file not found. Putting the \\ after the directory name apparently everything works, also executing the statement several times.. But it sounds very unusual, that the \\ makes the difference.
Can anybody explain me, if the trailing \\ is obligatory if the statement shall be executed several times?
Thanks
Rolf
z"\\TEMP" is a more concise way of writing "\\TEMP" & x"00".
The compiler can't "fill out the field with spaces" in a case like this because there's no destination to be filled with spaces. This is a CALL, not a MOVE. The CALLed program receives a reference (pointer) to the data supplied by the caller - it has exactly that data to look at.
If you do this:
working storage.
77 new-directory pic x(100).
procedure division.
move "\\TEMP" to new-directory
call "CBL_CHANGE_DIR" using new-directory
Then you'll get the results you expect, because new-directory will be space-filled and CBL_CHANGE_DIR will see the terminating space.