dick scherrer wrote:Hello,
And i still do not understand the "requirement" . . . .
d
Well, if
I misunderstood it, I didn't write the program correctly...
As I understand it: the TS has a table with at least two columns:
dbkey and
dbamount. A data set contains at least two fields,
pskey and
psamount. The SQL statement is:
UPDATE table
SET DBAMOUNT = PSAMOUNT
WHERE DBKEY = PSKEY
And that's it! The only thing that bewilders the TS is, since the number of records in the data set varies from day to day, there's no way to write a simple SPUFI to do this; an actual program (though, as I've said, a very trivial one) has to be written.
FTR, the program that I wrote was:
/* Rexx */
trace o
call RXSUBCOM "ADD", "SQL", "RXTASQL"
call DSNALI "OPEN", "HD0D", "RXTCS"
"EXECIO 1 DISKR TULIN"
do while (rc=0)
pull record
parse var record key amt
address sql "SELECT * FROM DDFHD0D.SHGB.ABBAS",
"WHERE COLUMN_A = '"key"'"
select
when (rc¬=0) then do
line = "RC =" rc " encountered when checking for key ["key"]"
push line
"EXECIO 1 DISKW TULPRINT"
end
when (sqlca.sqlcode<0) then do
line = "SQLCODE =" sqlca.sqlcode " encountered when checking",
"for key ["key"]"
push line
"EXECIO 1 DISKW TULPRINT"
end
when (sqlca.sqlrows=0) then do
line = "Key ["key"] not found on ABBAS"
push line
"EXECIO 1 DISKW TULPRINT"
end
when (sqlca.sqlrows>1) then do
line = "Multiple instances of key ["key"] found on ABBAS"
push line
"EXECIO 1 DISKW TULPRINT"
end
otherwise do
address sql "UPDATE DDFHD0D.SHGB.ABBAS",
" SET COLUMN_B = "amt,
" WHERE COLUMN_A = '"key"'"
select
when (rc¬=0) then do
line = "RC =" rc " encountered when checking for key ["key"]"
push line
"EXECIO 1 DISKW TULPRINT"
end
when (sqlca.sqlcode<0) then do
line = "SQLCODE =" sqlca.sqlcode " encountered when checking",
"for key ["key"]"
push line
"EXECIO 1 DISKW TULPRINT"
end
otherwise do
line = "Updated amount from" column_b.1 "to" amt "for",
"key ["key"]"
push line
"EXECIO 1 DISKW TULPRINT"
end
end
end
end
"EXECIO 1 DISKR TULIN"
end
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day