QSH won’t write in batch

65 pts.
Tags:
MBRbatch
QSH
WRITE
this is the code this was written by Avi HECHT and i got it from here : http://search400.techtarget.com/tip/0,289483,sid3_gci1098569,00.html AddEnvVar EnvVar(TM) Value(&RECORD) Replace(*YES) ChgVar Var(&DATA) Value('ECHO $TM >>' *BCAT + '/QSYS.LIB/' *TCAT &LIB *TCAT '.LIB/' + *TCAT &FILE *TCAT '.FILE/' *TCAT &MEMBER + *TCAT '.MBR') StrQsh Cmd(&DATA) RmvEnvVar EnvVar(TM) MonMsg MsgId(CPFA981) the problems are these: first you need to create a file if it doesn't exist. solved through : ChkObj Obj(&LIB/&FILE) ObjType(*FILE) Monmsg MSGID(CPF9801) Exec(DO) CrtPf File(&LIB/&FILE) RcdLen(512) MonMsg MsgId(CPF0000) Exec(Goto ERROR_) EndDo second, it will only write the first line ( the one that created the .MBR ) after that it doesn't add anything. i'm talking about batch. when in interactive it works charms. can anyone tell me why o0o why won't it work in batch , cuz it says it does! is there a way to fix it ?

Answer Wiki

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

Discuss This Question: 1  Reply

 
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
  • TomLiotta
    I don't know why it doesn't work for you -- it works fine for me, adding a new line whenever I execute the echo utility again. First things first, you're using a utility that isn't intended to be run outside of the Qshell environment. If you are starting Qshell multiples times in a job, make sure you understand what the shell environment does. You need to understand relationships such as file descriptors and input/output streams; file descriptors might be opened/closed/used by other parts of the same program. Make sure you understand how system-wide environment variables might alter how shell utilities work. Make sure you understand how environment variables from a submitting job might affect environment variables in the submitted job. Make sure you understand how a Qshell environment might be created in a job and either re-used or destroyed. Best advice is to use something that is intended to write lines to a physical file. The link you posted includes reference to the Qshell db2 utility. And that utility is intended for updating physical files. Even better, don't use CL for trying to update files; use a language that supports file output. Echo can and does write to physical files. Just don't expect it to work all the time because it probably won't. There can be too many factors outside of your control. Tom
    125,585 pointsBadges:
    report

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