can i create a directory in a CL with a variable name?

5 pts.
Tags:
IFS Directory
IFS Directory to iSeries Folder
iSeries
I am running a job that many people can submit at one time, I am writing files to qtemp and am putting into a directory in the IFS, but I would like to create a directory with the jobnumber as the directory name, then remove it when the job is complete.

Software/Hardware used:
iSeries, CLP

Answer Wiki

Thanks. We'll let you know when a new response is added.

In the CL you can use the RTVJOBA command.

You can pull in values like
JOB
USER
NBR
CURUSER
TYPE
SUBTYPE
SYSLIBL
CURLIB

try using these vaiables to create a unique directory

===================================================

<pre>DCL &JobNbr *CHAR 6
RTVJOBA NBR( &JobNbr )
MD &JobNbr</pre>
Those should create a subdirectory in the job’s current directory. The new subdirectory would be named 123456 if the job number was “123456″.

If you want it created as a subdirectory of, say, /home/MYDIR, then perhaps:

<pre>DCL &Path *CHAR 128 VALUE( ‘/home/MYDIR’ )
CHGVAR &Path ( &Path *tcat ‘/’ *cat &JobNbr )</pre>
Of course, you need variables long enough to hold the length of the paths you create.

MD is an alias for MKDIR. MKDIR is an alias for CRTDIR.

There are lots of alternative methods. Be aware that IFS names can include blanks. When names include trailing blanks, it can sometimes take some thinking to figure out why they’re tricky to delete.

Tom

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following