I created a Job for to conversion of a flat file. But the file name is not fixed. So I created another Job to get the file names in the directory and moved to the Hash file. Now, how to read the hash file in a loop and call the Job and pass the value for all the file name in the Hash file. I Hashkey as a unique in the Hash file and filename column.
Platform: Window2000
DS Version : 6.0.1
Thanks,
Best Regards,
Thiruma Valavan
To Read Hash File in A Loop
Moderators: chulett, rschirm, roy
Why read from a hash file when you can do a directory listing and loop from that?
Try this from a DS Batch job, and correct the html formatting that happens around the < > characters:
NTcmd="dir ":YourDirectoryPathParameter:"*.dat /b"
Call DSExecute("NT", NTcmd, ScreenOutput, ReturnCode)
Results = ""
If INDEX(ScreenOutput, "File Not Found", 1) Then
Results = "No files to process"
End Else
LinesInScreenOutput=DCOUNT(ScreenOutput, @AM)
For FileNamePtr=1 to LinesInScreenOutput
FileName = ScreenOutput< FileNamePtr > ***Remove spaces by the < >
Call DSLogInfo("Processing filename [":FileName:"]", "Msg")
Results< -1 > = FileName ***Remove spaces by the < >
*
* Put your job control logic here
*
Next FileNamePtr
End
Call DSLogInfo("The following files were processed: ":Results, "Msg")
Kenneth Bland
Try this from a DS Batch job, and correct the html formatting that happens around the < > characters:
NTcmd="dir ":YourDirectoryPathParameter:"*.dat /b"
Call DSExecute("NT", NTcmd, ScreenOutput, ReturnCode)
Results = ""
If INDEX(ScreenOutput, "File Not Found", 1) Then
Results = "No files to process"
End Else
LinesInScreenOutput=DCOUNT(ScreenOutput, @AM)
For FileNamePtr=1 to LinesInScreenOutput
FileName = ScreenOutput< FileNamePtr > ***Remove spaces by the < >
Call DSLogInfo("Processing filename [":FileName:"]", "Msg")
Results< -1 > = FileName ***Remove spaces by the < >
*
* Put your job control logic here
*
Next FileNamePtr
End
Call DSLogInfo("The following files were processed: ":Results, "Msg")
Kenneth Bland