Is there an easy way to do this, I have an SQL table set up like the folowing:
Create Table TRM003R (
"File Name" for Column "FILE" CHAR(10) Not NULL,
"File Library" for Column LIBRARY CHAR(10) Not NULL,
"Machine 1" for Column MACHINE1 CHAR(8) Not NULL,
"Machine 2" for Column MACHINE2 CHAR(8) Not NULL,
"Machine 3" for Column MACHINE3 CHAR(8) Not NULL,
"Machine 4" for Column MACHINE4 CHAR(8) Not NULL,
"Machine 5" for Column MACHINE5 CHAR(8) Not NULL,
"Machine 6" for Column MACHINE6 CHAR(8) Not NULL,
"Machine 7" for Column MACHINE7 CHAR(8) Not NULL,
"Machine 8" for Column MACHINE8 CHAR(8) Not NULL,
"Machine 9" for Column MACHINE9 CHAR(8) Not NULL,
... etc.
Up to 20 Machines(AS/400s). This is a list of machines that I need to connect to to update a file.
Now what I want to do is pull all 20 of those fields into one field in the RPG. I want to pull it straight into an array so that I can loop through the machines and connect to them. I tried a pointer:
D MachinesPtr S *
*
D Machines S 160 BASED(MachinesPtr)
*
/Free
MachinesPtr = %ADDR(Machine1);
Read TRM003F;
*InLR = *On;
Return;
/End-Free
but all I pull is the first field. Is there anyway to pull this into a single field/array without having to do:
array(1) = machine1;
array(2) = machien2;
array(3) = machine3;
etc.?
I keep thinking there is some easy way to do this but for some reason I am drawing a blank. If I can't do it I am going to make a 160 char field in the file and just count out spaces when populating that field...but that would be a pain for other users in future maintenance.
Create Table TRM003R (
"File Name" for Column "FILE" CHAR(10) Not NULL,
"File Library" for Column LIBRARY CHAR(10) Not NULL,
"Machine 1" for Column MACHINE1 CHAR(8) Not NULL,
"Machine 2" for Column MACHINE2 CHAR(8) Not NULL,
"Machine 3" for Column MACHINE3 CHAR(8) Not NULL,
"Machine 4" for Column MACHINE4 CHAR(8) Not NULL,
"Machine 5" for Column MACHINE5 CHAR(8) Not NULL,
"Machine 6" for Column MACHINE6 CHAR(8) Not NULL,
"Machine 7" for Column MACHINE7 CHAR(8) Not NULL,
"Machine 8" for Column MACHINE8 CHAR(8) Not NULL,
"Machine 9" for Column MACHINE9 CHAR(8) Not NULL,
... etc.
Up to 20 Machines(AS/400s). This is a list of machines that I need to connect to to update a file.
Now what I want to do is pull all 20 of those fields into one field in the RPG. I want to pull it straight into an array so that I can loop through the machines and connect to them. I tried a pointer:
D MachinesPtr S *
*
D Machines S 160 BASED(MachinesPtr)
*
/Free
MachinesPtr = %ADDR(Machine1);
Read TRM003F;
*InLR = *On;
Return;
/End-Free
but all I pull is the first field. Is there anyway to pull this into a single field/array without having to do:
array(1) = machine1;
array(2) = machien2;
array(3) = machine3;
etc.?
I keep thinking there is some easy way to do this but for some reason I am drawing a blank. If I can't do it I am going to make a 160 char field in the file and just count out spaces when populating that field...but that would be a pain for other users in future maintenance.