OPEN "","JobRunInfoParms" TO v_connectionParamsDataFile
ON ERROR Call DSLogWarn('Failed to open file JobRunInfoParms. Error':STATUS(), c_routineName ); Return
ELSE Call DSLogWarn('Failed to open file JobRunInfoParms. Error':STATUS(), c_routineName ); Return
openseq v_connectionParamsDataFile To ParamFileVar
On Error
Call DSLogWarn('Error opening parameters file': Status(), c_routineName ); Return
Else Call DSLogWarn('Cannot open parameters file': Status(), c_routineName) ; Return
End
Loop
While ReadSeq Line From ParamFileVar
Result := Line
Exit
End
Repeat
CloseSeq ParamFileVar
You are in a function, so all of your RETURN statements need to look like RETURN({some value}). You also have an exit statement in your loop that would get executed after the 1st read, and an unbalanced END in there as well.
No.
1. You are opening up a local hashed file called "JobRunInfoParms".
2. You then try to open a sequential file, but instead of the giving path you are using the file handle from (1). This cannot work. The file is a hashed file or a sequential one, but not both.
3. Assuming you are reading the sequential file, you need to remove your "exit" and superfluous "end" statements.
Loop
While ReadSeq Line From ParamFileVar
Result := Line
Exit
End
Repeat
CloseSeq ParamFileVar
Note also that the Else clause can be taken in an OpenSeq statement even though the file is open for writing. This indicates that the file does not yet exist; the successful open is indicated by Status() returning 0.
Search the forum for OpenSequentialFile which illustrates all the possibilities when opening a file for sequential access.
Please post a specification (in English, not in code) for what you want this routine to achieve. Without that it's impossible to fulfil your original request to indicate whether your code is correct.
Where do you intend to use this routine? If it's per-row in a job, do you really want the overhead of opening and closing the file each time? There is a better solution in this case, but we need to know exactly what you want to accomplish.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ArndW wrote:No.
1. You are opening up a local hashed file called "JobRunInfoParms".
2. You then try to open a sequential file,
Can any other file be opened from the loca as open a hashed file?
The only thing i want to do I am able to open a hashed file from local ?
similarly can i open any ther file like DSParams or anything and read the contents from it?