Take the 2-minute tour ×

i want to write the output of a qshell command to local data area so that it could be globally used by programs.is there some way to write from stdout file to local data area .I want it to be done through CL..its urgent thanks

share|improve this question
The question needs to be clarified. Output to a data area would either be done by CL or by a Qshell utility. If you want the output of a Qshell utility to go to a data area, it would done by Qshell and not "done through CL". CL can invoke Qshell utilities, and Qshell can invoke CL commands; but they are two very different environments and run in separate jobs. Also, if the data area is a "local data area", then by definition it cannot be accessed "globally". It would have to be a named data area (or data queue or message queue, etc.) It'd be easier to answer if we knew why QSH was needed. –  user2338816 Mar 23 at 12:51

3 Answers 3

QSH CMD('system chgdtaara dtaara\(qgpl/dataarea\) value\($(echo test)\)')
share|improve this answer
thanks a lot but i dont know what name should be given to the data area ..i mean do i have to write *lda as i am trying to store the value in local data area or something else beacause when i am running this a error msg comes showing command not found ..please help me out .. –  abhinav singh May 12 '10 at 8:52
To store the output in the *LDA just change the dtaara(qgpl/dataarea) parameter to dtaara(*LDA). I'm not sure why you would be receiving a command not found message. Can you post the exact message? –  JamesA May 12 '10 at 14:29

I don't think you can update the *LDA from qshell ... as commands run through it, I think, are in a separate job.

You might want to consider using a named data queue ... you can use the dataq command from qshell.

It would probably be best to use a keyed data queue ... but I'm unsure how you would specify the key on the dataq command.

share|improve this answer
A named data queue can be used, especially if it's a *KEYED data queue in a permanent library. A CL program can use RTVJOBA to retrieve the fully qualified job name and place it into a job-level environment variable. The *DTAQ key would need be at least 26 bytes, and could be larger if a timestamp is needed for uniqueness. Any number of jobs could use the same *DTAQ. If permanent entries are needed, a *KEYED *USRIDX might be better; but there is no native QShell utility for adding entries to a *USRIDX. (It's easy enough to create a *CMD wrapper for that as well as for *KEYED *DTAQs.) –  user2338816 Mar 30 at 4:18

use iSeries dtarea construct as:

wc -l /tmp/mlco02.txt | datarea -w /qsys.lib/qgpl.lib/robtest.dtaara      

the data area qgpl/robtest is previously created

In this case I needed line (record) count of IFS file, so CLp could get it and split big files down.

share|improve this answer

Your Answer


