Cal I load a record SET into a work file using SQL within RPGLE?
570 pts.
0
Q:
Cal I load a record SET into a work file using SQL within RPGLE?
ALL -

I have to process a set of Inventory Transactions based on W/H, Product, From Date, and To Date. Normally, I would jump into a Do Loop; read the SQL cursor; write the record to a work file; process until EOF.

Can an SQL statement do all of that for me in one statement? I have not been able to do it in Interactive SQL.

Phil

ASKED: Oct 1 2009  4:40 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
570 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
Hay Other Phil
INSERT INTO MYLIBRARY/TEMPF0101 SELECT * FROM DATALIB/F0101 WHERE ABAC02=’ABC’
This format request that you fill all fields of TEMPF0101 in order with fields from the select statement

Paul Conte pg 122 adds a field list -- only field1,2,3 will be populated -- others default or null.

Insert into file1 (field1, field2, field3)
Select xfield1, xfield2, xfield3 from xfile where ....

Hope this helps
Phil

EXCELLENT!
I just check the SQLCOD for problems.
0000 = no problems.
0100 = no rows satisfy the statement.

Now, some where in the SQL Communications area is the number of records processed.
Any Ideas?

The Other Phil

=======================
Phil
Great question -- how would I solve it
Add H debug(*YES) and right after the sql command put Dump
You should see the anwer somewhere in the SQL stuff in the Dump
Let me know the answer.

The other Phil -- go Cards

=======================
Good idea.
I have most of the above code in a sub-procedure I use to check the SQLCOD status after I exec a statement.

And the winner is:
SQLERRD(3)
The number of rows updated, inserted, or deleted by SQL.



Handling SQL error return codes using the SQLCA /A]

The Other Phil
Cards? WHO?
Last Answered: Oct 1 2009  10:24 PM GMT by MurrayInfoSys   570 pts.
Latest Contributors: Philpl1jb   24570 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



0