Hi Allen,
I don't have an example of reading an external file but I do have one for writing to on. It should be fairly easy to read the script and figure out the differences to make it read.
function cm_load()
-- Set up environment
sParm = 'pro=lkp'
sParm = sParm .. ',srch="SALESMAN_ID"'
sParm = sParm .. ',rep="TERRITORY"'
sParm = sParm .. ',id=SAMPLES.SALES_CHECK'
sParm = sParm .. ',lib=ORACLE'
sParm = sParm .. ',user=optim'
sParm = sParm .. ',pass=manager1'
sParm = sParm .. ',conn=win7vm2'
sParm = sParm .. ',whennf=pre'
sParm = sParm .. ',flddef1=(name="SALESMAN_ID",dt=wvarchar_sz)'
sParm = sParm .. ',flddef2=(name="TERRITORY",dt=wvarchar_sz)'
optim.print('Static Parameters Are: '..sParm)
-- Open output file
file = assert(uio.open("C:\\IBM\\data\\test.txt","w+"))
-- setFile()
end
function cm_transform()
local inVal = optim.source.getcolumnvalue()
local outVal = nil
outVal = optim.mask(inVal,sParm)
if outVal == nil then
file:write(inVal.."\n")
optim.print('Value missing for: '..inVal)
end
optim.target.setcolumnvalue(inVal)
end
function cm_unload()
file:close()
end
function setFile()
file:write("set output C:\\IBM\\data\\test.out")
file:write("set pagesize 99999")
file:write(" ")
end
I hope that helps some.
Jimmy
------------------------------
JIMMY WILSON
------------------------------
Original Message:
Sent: Mon September 09, 2019 02:14 PM
From: Allen Tsygan
Subject: z/OS Lua I/O processing
We use Lua procedures in the Column Maps with in Optim z/OS. I was wondering if there is a way in Lua to read an input batch file within the CM? and if so how is this accomplished?
Thank you,
Allen.
------------------------------
Allen Tsygan
------------------------------
#InfoSphereOptim
#Optim