OK. This isn't a tutorial nor a complaint. It's more of a "this is what I'm figuring out" and "is this really correct"...
(Also remember, I'm having to do this in Structured RPG, not /Free...
For simplistic definition, consider the following:
InvTable
ShipID
Whse
Invoice
InvDate
You don't use F-Specs and define the fields to the program as:
You have a DDS Screen with the following:
So, you create an entries to take care of the Display screen:
Somewhere in your code, you want to get the information into your screen vars and display/update them. Logic says, just "Select" them into your Screen Data Structure, Scr1o.. as in:
But, the SQL Pre-compiler doesn't like this and tells you that "SCR1O is not defined or not useable"
So, from what I've found, you can create another DS as:
Change your Select Statement to:
BTW, you "COULD" do a Select * into :Inv, but Biggs told me not to...
Then you can do an EVAL-CORR as in:
and proceed with your coding as in:
OK, all this works and the DataFlow is actually pretty nice. There are a reduced number of "Eval DspF1 = F1" statements and you can format data to your desired sizes etc just with the EVAL-CORR statement alone.
My curiosity here is why the "Select..Into :Scr1o" isn't allowed past the SQL Pre-Compiler? The Data Structure is defined and is available .. just not a direct derivative of an External Definition.
Discussion, corrections or clarifications are welcome... this is just what I'm discovering as I move through the circle of SDLC as we know it.
(Also remember, I'm having to do this in Structured RPG, not /Free...
For simplistic definition, consider the following:
InvTable
ShipID
Whse
Invoice
InvDate
You don't use F-Specs and define the fields to the program as:
Code:
d Inv e ds ExtName( InvTable ) Qualified Inz
Code:
A R SCR1 A SHIPID B 13 50 A INVOICE B 5 18 A WHSE B 14 62 A INVDATE B 6 18
Code:
d Scr1o ds LikeRec( Scr1 : *Output ) Inz d Scr1i ds LikeRec( Scr1 : *Input ) Inz
Code:
Select ShipID, Invoice, Whse, InvDate into :Scr1o From InvTable
So, from what I've found, you can create another DS as:
Code:
d InvDS ds Qualified d ShipID Like( Inv.ShipID ) Inz d Invoice Like( Inv.Invoice ) Inz d Whse Like( Inv.Whse ) Inz d InvDate Like( Inv.InvDate ) Inz
Code:
Select ShipID, Invoice, Whse, InvDate into :InvDS From InvTable
Then you can do an EVAL-CORR as in:
Code:
c Eval-Corr Scr1o = InvDS
Code:
... c Write Scr1 Scr1o c Read Scr1 Scr1i ...
My curiosity here is why the "Select..Into :Scr1o" isn't allowed past the SQL Pre-Compiler? The Data Structure is defined and is available .. just not a direct derivative of an External Definition.
Discussion, corrections or clarifications are welcome... this is just what I'm discovering as I move through the circle of SDLC as we know it.
Comment