Showing posts with label Routine reads first line of Text file. Show all posts
Showing posts with label Routine reads first line of Text file. Show all posts

Monday, June 30, 2008


PREVIOUS


2.9. Datastage routine which reads the first line from a text file


Note! work dir and file1 are parameters passed to the routine.


* open file1
OPENSEQ work_dir : '\' : file1 TO H.FILE1 THEN
CALL DSLogInfo("******************** File " : file1 : " opened successfully", "JobControl")
END ELSE
CALL DSLogInfo("Unable to open file", "JobControl")
ABORT
END

READSEQ FILE1.RECORD FROM H.FILE1 ELSE
Call DSLogWarn("******************** File is empty", "JobControl")
END


firstline = Trim(FILE1.RECORD[1,32]," ","A") ******* will read the first 32 chars
Call DSLogInfo("******************** Record read: " : firstline, "JobControl")
CLOSESEQ H.FILE1



NEXT