Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using variable for ddname in EXECIO 2

Hdr95

Programmer
Jul 31, 2024
2
0
0
FR
Hello,

I'm a beginner in REXX language , i'm trying to use à variable for the DDNAME parameter in EXECIO command :

"ALLOC F(OUT1) DA('FILE.OUT1') OLD"
"ALLOC F(OUT2) DA('FILE.OUT2') OLD"
LL1 = "SAMPLE LINE"
FILEW = "OUT1"
"EXECIO 1 DISKW FILEW (STEM LL1)"
FILEW = "OUT2"
"EXECIO 1 DISKW FILEW (STEM LL1)"

Result => IRX0555E The input or output file FILEW is not allocated.

Can someone could help me ?

Thank you.


 
Hello Hdr95,

You got the error, because in your command
Code:
"EXECIO 1 DISKW FILEW (STEM LL1)"
the variable name FILEW was literally used and not its value OUT1.

To use the value of the variable you need this:
Code:
"EXECIO 1 DISKW" FILEW "(STEM LL1)"

If you are a beginner, then it's good first to compose command into a string and then print it before sending it to execute. So you will see what command you are executing and that helps you with debugging.

Like this:
Code:
-- create command
my_command = "ALLOC F(OUT1) DA('FILE.OUT1') OLD"
-- print command 
say my_command
-- execute command
my_command

-- create command
my_command = "ALLOC F(OUT2) DA('FILE.OUT2') OLD"
-- print command 
say my_command
-- execute command
my_command

LL1 = "SAMPLE LINE"

FILEW = "OUT1"
-- create command
my_command = "EXECIO 1 DISKW" FILEW "(STEM LL1)"
-- print command
say my_command
-- execute command
my_command

FILEW = "OUT2"
-- create command
my_command = "EXECIO 1 DISKW" FILEW "(STEM LL1)"
-- print command
say my_command
-- execute command
my_command
 
Hi Mikrom,

Thank you so much for your help and for the advice on debugging.

Have a good day

Regards
 

Part and Inventory Search

Sponsor

Back
Top