How to create a AS400 Qshell script (.sh) file

115 pts.
Tags:
AS/400 scripts
AS400 qshell script
Qshell
STRQSH
Hi, I want to run a command STRQSH CMD ('/REPORTGENERATOR/move2current.sh')

Where move2current would be a .sh file with commands as below: rm /HPA_CURRENT/_YOUR_AS400_NAME*.CSV cp /REPORTGENERATOR/*$(date '+%Y%m%d')* /HPA_CURRENT #set new owner chown hpa_transf /HPA_CURRENT/*.CSV

My question is how to create this move2current.sh file?

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.

Discuss This Question: 6  Replies

 
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.
  • TomLiotta
    Use the EDTF command.
    EDTF  '/REPORTGENERATOR/move2current.sh'
    The EDTF command opens a simple text file editor. If the /REPORTGENERATOR directory is shared out to the network, then you can use any PC editor to create the script file. Tom
    125,585 pointsBadges:
    report
  • DeepikaR
    Thanks a lot Tom, I am able to run the script now. But i am getting the error for the below command: cp /REPORTGENERATOR/*$(date '+%Y%m%d')* /HPA_CURRENT The file name that exist in directory is in the format of "system_name+date+sequence number" What Do I need to edit in the above command to copy the files that have the substring of today's date. Regards, Deepika Rohilla
    115 pointsBadges:
    report
  • TomLiotta
    The file name that exist in directory is in the format of “system_name+date+sequence number” Please show one or two examples of actual report names. Tom
    125,585 pointsBadges:
    report
  • DeepikaR
    Hi, for example suppose the file name is "ABTT2011081900000450002" This is the report name for the server ABTT on 19th Aug 2011 for the report sequence number 45 for the report copy number 2. I want to retrieve similar kind of reports for a particular date irrespective of report sequence number and report copy number. I hope this information would be helpful to understand the query. Regards, Deepika Rohilla
    115 pointsBadges:
    report
  • amarkotha
    Hi DeepikaR,

    i am new to shell script on iseries. actually i have created one sample script(see below for the script) 
    ================
    #!/bin/ksh

    cd /QIBM/Userdata/employeedetails/
    pwd
    ls -ltr
    ===============================
    i placed it under /QIBM/testscript.ksh and try to run the script on main menu 
    STRQSH CMD('/QIBM/testscript.ksh')

    got below error, can you please tell me what i did wrong 
    -----------------------------------------------------
    qsh: 001-0014 Command /QIBM/testscript.ksh not found. 
    Press ENTER to end terminal session.                  
    -----------------------------------------------------------

    my doubt is ,
    ->is it possible to create shell script on iseries?
    -> if not can you please help me which script would work , if possible please share the video link to go through and understand it
    10 pointsBadges:
    report
  • TheRealRaven
    First, /QIBM is not a location where you should be storing anything. /QIBM/ProdData and /QIBM/UserData are viable locations, but you should first discuss with IBM Support how those directories should be used. For your testing, you should probably be storing scripts in your /home directory.

    Also, ksh isn't part of QShell. The shell is qsh for QShell.

    If for some reason you actually want to use ksh, you should work in PASE rather than QShell.

    So, yes, it's possible to create scripts on iSeries. However, choice of shells depends on what is installed, pretty much the same as on any system; and we don't know what's installed on yours.
    21,835 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.

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

Following

Share this item with your network: