How To Pass Velues To Parameters
Moderators: chulett, rschirm, roy
How To Pass Velues To Parameters
Hi
I want to read a text file and Pass a couple of values to 2 JOB PARAMETERS. Can it be achieved in job control routine?
Is it possible to asign values to parameters in Job Control?
Regards
Palasjyoti
I want to read a text file and Pass a couple of values to 2 JOB PARAMETERS. Can it be achieved in job control routine?
Is it possible to asign values to parameters in Job Control?
Regards
Palasjyoti
Yes, it can be done. I would write a function, "ReadMySeqFile" which accepts the filename&path as an input parameter and returns a delimited string which you can then use to get the parameters to pass on to other jobs from the sequence. A sample of this code could be (with error-handling removed)
Code: Select all
ReadMySeqFile(InFile)
EQUATE Delimiter to ','
Ans = ''
OPENSEQ InFile TO InFilePtr ELSE CALL DSLogFatal('Cannot open file "':InFile:'".','')
Finished = 0
READSEQ InRecord FROM InFilePtr ELSE Finished = 1
LOOP UNTIL Finished
Ans := Delimiter:InRecord
READSEQ InRecord FROM InFilePtr ELSE Finished = 1
REPEAT
Ans = Ans[2,9999] ;** remove first delimiter
CLOSE InFilePtr
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
SETting Up Job params
Thanks Andrw
yes, it will give me the values from the Seq File. Now I want Set Parameters in my job as those values from the Seq file.
I added following code in Job Control to asign NAME="rubu". But this routine is giving both the warning messages included in... saying "BAD HANDLE". Why is it happening. Cant I SET parameter of the same job I inside job control?
ErrCode = DSSetParam (DSJ.ME, "NAME","rubu")
IF ErrCode <>0 THEN
IF ErrCode =DSJE.BADHANDLE
THEN
Call DSLogWarn("BAD HANDLE","Job Control")
END
Call DSLogWarn("Not asign","Job Control")
END
yes, it will give me the values from the Seq File. Now I want Set Parameters in my job as those values from the Seq file.
I added following code in Job Control to asign NAME="rubu". But this routine is giving both the warning messages included in... saying "BAD HANDLE". Why is it happening. Cant I SET parameter of the same job I inside job control?
ErrCode = DSSetParam (DSJ.ME, "NAME","rubu")
IF ErrCode <>0 THEN
IF ErrCode =DSJE.BADHANDLE
THEN
Call DSLogWarn("BAD HANDLE","Job Control")
END
Call DSLogWarn("Not asign","Job Control")
END
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Re: SETting Up Job params
Nope, it's too late at that point. Parameters must be set before the job is run, so job control code is typically setting the parameters for and running other jobs.Rubu wrote:I added following code in Job Control to asign NAME="rubu". But this routine is giving both the warning messages included in... saying "BAD HANDLE". Why is it happening. Cant I SET parameter of the same job I inside job control?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
I have same kind of requirement to read a sequential file which contains a single record seperated by "," . I need to use this values as parameters in same job to get the data from DB2. I created function using
ReadMySeqFile(InFile)
EQUATE Delimiter to ','
Ans = ''
OPENSEQ InFile TO InFilePtr ELSE CALL DSLogFatal('Cannot open file "':InFile:'".','')
Finished = 0
READSEQ InRecord FROM InFilePtr ELSE Finished = 1
LOOP UNTIL Finished
Ans := Delimiter:InRecord
READSEQ InRecord FROM InFilePtr ELSE Finished = 1
REPEAT
Ans = Ans[2,9999] ;** remove first delimiter
CLOSESEQ InFilePtr
when i test this function by passing inputfile path and name , i am not getting any result.
Rubu, Arndw if you got successful can you please direct me how to do.
Thx
ReadMySeqFile(InFile)
EQUATE Delimiter to ','
Ans = ''
OPENSEQ InFile TO InFilePtr ELSE CALL DSLogFatal('Cannot open file "':InFile:'".','')
Finished = 0
READSEQ InRecord FROM InFilePtr ELSE Finished = 1
LOOP UNTIL Finished
Ans := Delimiter:InRecord
READSEQ InRecord FROM InFilePtr ELSE Finished = 1
REPEAT
Ans = Ans[2,9999] ;** remove first delimiter
CLOSESEQ InFilePtr
when i test this function by passing inputfile path and name , i am not getting any result.
Rubu, Arndw if you got successful can you please direct me how to do.
Thx
Titto,
Suggestions/Questions:
-are you getting an abort in the log file when opening in the file?, i.e. an incorrectly formed path?
try putting "Counter += 1" and "CALL DSLogInfo(Counter,'')" inside the loop and seeing if it loops for each line.
If you test from within the manager you will need to double-click and on the return value to see any error/warning messages. Have you done this?
Suggestions/Questions:
-are you getting an abort in the log file when opening in the file?, i.e. an incorrectly formed path?
try putting "Counter += 1" and "CALL DSLogInfo(Counter,'')" inside the loop and seeing if it loops for each line.
If you test from within the manager you will need to double-click and on the return value to see any error/warning messages. Have you done this?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 122
- Joined: Mon Jul 05, 2004 1:33 pm
- Location: MA