Hello,
I have a 4 subprocedures. I'm trying to SQL insert values unto a file (in createWorkDetailRecord) using values acquired from the other procs. I defined my DS globally (DS_SVWRD), and then locally in the 1st proc (lDS_SVWRD).. Here's my code:
DCL-DS DS_SVWRD ExtName('SVWRD') Prefix( @ ) Inz;
Dcl-Proc createSchedule;
Dcl-PI *N;
End-PI;
Dcl-S lNumberHoursWithAvailableUnits Zoned( 2:0 );
Dcl-S lAssignedUnits Zoned( 5:0 );
Dcl-S lOverbookUnits Zoned( 5:0 );
Dcl-DS lDS_SVWRD LikeDS( DS_SVWRD );
:
: // Do stuff
:
populateAvailableUnitsArray( lNumberHoursWithAvailableUnits:
lDS_SVWRD );
updateScheduleFile( lOverbookUnits: lDS_SVWRD );
// Create work detail record - SYWSD
createWorkDetailRecord( lAssignedUnits: lOverbookUnits: lDS_SVWRD);
Return;
End-proc createSchedule;
Dcl-Proc populateAvailableUnitsArray;
Dcl-PI *N;
pNumberHoursWithAvailableUnits Zoned( 2:0 );
pDS_SVWRD LikeDS( DS_SVWRD );
End-PI;
:
:
Exec Sql Declare SYWSDCursor1 Cursor for
Select WSDHH,
WSDSUS - (WSDAUS + WSDAUT)
from SYWSD
where WSDCOD = : @WRDPSC
and WSDYY = : gApptYear
and WSDMM = : gApptMonth
and WSDDD = : gApptDay
and WSDHH >= 8
and WSDHH <= 17
order by WSDHH;
:
:
Return;
END-PROC populateAvailableUnitsArray;
Dcl-Proc updateScheduleFile;
Dcl-PI *N;
pOverbookUnits Zoned( 5:0 );
pDS_SVWRD LikeDS( DS_SVWRD );
End-PI;
:
:
Exec sql
Update sywsd
Set WSDAUS = WSDAUS + :lUnits
Where WSDCOD = :@WRDPSC
and WSDYY = :gApptYear
and WSDMM = :gApptMonth
and WSDDD = :gApptDay
and WSDHH = :lHour;
:
Return;
End-Proc updateScheduleFile;
DCL-PROC createWorkDetailRecord;
Dcl-Pi *N;
pAssignedUnits Zoned( 5:0 );
pOverbookUnits Zoned( 5:0 );
pDS_SVWRD LikeDS( DS_SVWRD );
End-Pi;
:
:
Exec sql
INSERT INTO SVWRD ( WRDSO#, WRDDAT, WRDTIM, WRDSEQ, WRDEMP,
WRDPSC, WRDWUN, WRDNOT, WRDACD, WRDADT,
WRDATA, WRDATB, WRDACR, WRDANG, WRDSCD,
WRDSDT, WRDSTM, WRDRNC, WRDBPI, WRDBEI,
WRDBP2, WRDBE2, WRDBNM, WRDRMK, WRDOUI,
WRDOWR, WRDOWA, WRDH00, WRDH01, WRDH02,
WRDH03, WRDH04, WRDH05, WRDH06, WRDH07,
WRDH08, WRDH09, WRDH10, WRDH11, WRDH12,
WRDH13, WRDH14, WRDH15, WRDH16, WRDH17,
WRDH18, WRDH19, WRDH20, WRDH21, WRDH22,
WRDH23, WRDRUA, WRDOVB )
values( :@WRDSO#, :@WRDDAT, :@WRDTIM, :@WRDSEQ, :@WRDEMP,
:@WRDPSC, :@WRDWUN, :@WRDNOT, :@WRDACD, :@WRDADT,
:@WRDATA, :@WRDATB, :@WRDACR, :@WRDANG, :@WRDSCD,
:@WRDSDT, :@WRDSTM, :@WRDRNC, :@WRDBPI, :@WRDBEI,
:@WRDBP2, :@WRDBE2, :@WRDBNM, :@WRDRMK, :@WRDOUI,
:@WRDOWR, :@WRDOWA, :@WRDH00, :@WRDH01, :@WRDH02,
:@WRDH03, :@WRDH04, :@WRDH05, :@WRDH06, :@WRDH07,
:@WRDH08, :@WRDH09, :@WRDH10, :@WRDH11, :@WRDH12,
:@WRDH13, :@WRDH14, :@WRDH15, :@WRDH16, :@WRDH17,
:@WRDH18, :@WRDH19, :@WRDH20, :@WRDH21, :@WRDH22,
:@WRDH23, :@WRDRUA, :@WRDOVB );
// Log any SQL Errors
validSql(a@CommArea:SQLSTATE);
Return;
End-Proc createWorkDetailRecord;
Problem is, I'm encountering SQL0312 for the fields @WRDxxx:
SQL0312 30 1937 Position 33 Variable @WRDPSC not defined or not usable.
SQL0312 30 2006 Position 32 Variable @WRDSO# not defined or not usable.
SQL0312 30 2006 Position 42 Variable @WRDDAT not defined or not usable.
SQL0312 30 2006 Position 52 Variable @WRDTIM not defined or not usable.
SQL0312 30 2006 Position 62 Variable @WRDSEQ not defined or not usable.
What's wrong with my code?
Thank you in advance!
I have a 4 subprocedures. I'm trying to SQL insert values unto a file (in createWorkDetailRecord) using values acquired from the other procs. I defined my DS globally (DS_SVWRD), and then locally in the 1st proc (lDS_SVWRD).. Here's my code:
DCL-DS DS_SVWRD ExtName('SVWRD') Prefix( @ ) Inz;
Dcl-Proc createSchedule;
Dcl-PI *N;
End-PI;
Dcl-S lNumberHoursWithAvailableUnits Zoned( 2:0 );
Dcl-S lAssignedUnits Zoned( 5:0 );
Dcl-S lOverbookUnits Zoned( 5:0 );
Dcl-DS lDS_SVWRD LikeDS( DS_SVWRD );
:
: // Do stuff
:
populateAvailableUnitsArray( lNumberHoursWithAvailableUnits:
lDS_SVWRD );
updateScheduleFile( lOverbookUnits: lDS_SVWRD );
// Create work detail record - SYWSD
createWorkDetailRecord( lAssignedUnits: lOverbookUnits: lDS_SVWRD);
Return;
End-proc createSchedule;
Dcl-Proc populateAvailableUnitsArray;
Dcl-PI *N;
pNumberHoursWithAvailableUnits Zoned( 2:0 );
pDS_SVWRD LikeDS( DS_SVWRD );
End-PI;
:
:
Exec Sql Declare SYWSDCursor1 Cursor for
Select WSDHH,
WSDSUS - (WSDAUS + WSDAUT)
from SYWSD
where WSDCOD = : @WRDPSC
and WSDYY = : gApptYear
and WSDMM = : gApptMonth
and WSDDD = : gApptDay
and WSDHH >= 8
and WSDHH <= 17
order by WSDHH;
:
:
Return;
END-PROC populateAvailableUnitsArray;
Dcl-Proc updateScheduleFile;
Dcl-PI *N;
pOverbookUnits Zoned( 5:0 );
pDS_SVWRD LikeDS( DS_SVWRD );
End-PI;
:
:
Exec sql
Update sywsd
Set WSDAUS = WSDAUS + :lUnits
Where WSDCOD = :@WRDPSC
and WSDYY = :gApptYear
and WSDMM = :gApptMonth
and WSDDD = :gApptDay
and WSDHH = :lHour;
:
Return;
End-Proc updateScheduleFile;
DCL-PROC createWorkDetailRecord;
Dcl-Pi *N;
pAssignedUnits Zoned( 5:0 );
pOverbookUnits Zoned( 5:0 );
pDS_SVWRD LikeDS( DS_SVWRD );
End-Pi;
:
:
Exec sql
INSERT INTO SVWRD ( WRDSO#, WRDDAT, WRDTIM, WRDSEQ, WRDEMP,
WRDPSC, WRDWUN, WRDNOT, WRDACD, WRDADT,
WRDATA, WRDATB, WRDACR, WRDANG, WRDSCD,
WRDSDT, WRDSTM, WRDRNC, WRDBPI, WRDBEI,
WRDBP2, WRDBE2, WRDBNM, WRDRMK, WRDOUI,
WRDOWR, WRDOWA, WRDH00, WRDH01, WRDH02,
WRDH03, WRDH04, WRDH05, WRDH06, WRDH07,
WRDH08, WRDH09, WRDH10, WRDH11, WRDH12,
WRDH13, WRDH14, WRDH15, WRDH16, WRDH17,
WRDH18, WRDH19, WRDH20, WRDH21, WRDH22,
WRDH23, WRDRUA, WRDOVB )
values( :@WRDSO#, :@WRDDAT, :@WRDTIM, :@WRDSEQ, :@WRDEMP,
:@WRDPSC, :@WRDWUN, :@WRDNOT, :@WRDACD, :@WRDADT,
:@WRDATA, :@WRDATB, :@WRDACR, :@WRDANG, :@WRDSCD,
:@WRDSDT, :@WRDSTM, :@WRDRNC, :@WRDBPI, :@WRDBEI,
:@WRDBP2, :@WRDBE2, :@WRDBNM, :@WRDRMK, :@WRDOUI,
:@WRDOWR, :@WRDOWA, :@WRDH00, :@WRDH01, :@WRDH02,
:@WRDH03, :@WRDH04, :@WRDH05, :@WRDH06, :@WRDH07,
:@WRDH08, :@WRDH09, :@WRDH10, :@WRDH11, :@WRDH12,
:@WRDH13, :@WRDH14, :@WRDH15, :@WRDH16, :@WRDH17,
:@WRDH18, :@WRDH19, :@WRDH20, :@WRDH21, :@WRDH22,
:@WRDH23, :@WRDRUA, :@WRDOVB );
// Log any SQL Errors
validSql(a@CommArea:SQLSTATE);
Return;
End-Proc createWorkDetailRecord;
Problem is, I'm encountering SQL0312 for the fields @WRDxxx:
SQL0312 30 1937 Position 33 Variable @WRDPSC not defined or not usable.
SQL0312 30 2006 Position 32 Variable @WRDSO# not defined or not usable.
SQL0312 30 2006 Position 42 Variable @WRDDAT not defined or not usable.
SQL0312 30 2006 Position 52 Variable @WRDTIM not defined or not usable.
SQL0312 30 2006 Position 62 Variable @WRDSEQ not defined or not usable.
What's wrong with my code?
Thank you in advance!
Comment