× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Yeah I am quite new to scripting but I found on our iseries that for some bizarre reason it needed a pound (£) symbol instead of ($) on variable declerations, not sure why - I'm quite new to this

It was just receiving null for the command parameters and this was the reason at the time

Hope that relates

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of rob@xxxxxxxxx
Sent: 08 May 2009 21:51
To: Midrange Systems Technical Discussion
Subject: RE: QSH setting a variable

Working on my very first shell script just to help you out...

Here it is:
echo $1
mycmd='CPYFRMIMPF FROMSTMF('${1}') TOFILE(ROB/TESTSH) RCDDLM(*CRLF)'
echo $mycmd
system $mycmd

It has an issue but here goes...

testshell '/rob/testsh'
/rob/testsh
CPYFRMIMPF FROMSTMF(/rob/testsh) TOFILE(ROB/TESTSH) RCDDLM(*CRLF)
CPD0104: Expression not allowed for parameter FROMSTMF.
CPF0001: Error found on CPYFRMIMPF command.
CPC2206: Ownership of object QZSHSYSTEM in QTEMP type *USRSPC changed.
$

Note: I do not use eval mycmd. I just use mycmd.
The bug now is how do I get the apostrophes around the parameter $1
without turning it into a comment.

This works:
echo $1
mycmd='CPYFRMIMPF FROMSTMF(''"'${1}'"'') TOFILE(ROB/TESTSH) RCDDLM(*CRLF)'
echo $mycmd
system $mycmd

testshell /rob/testsh
/rob/testsh
CPYFRMIMPF FROMSTMF("/rob/testsh") TOFILE(ROB/TESTSH) RCDDLM(*CRLF)
CPC2206: Ownership of object QCPIMTEMPS in QTEMP type *USRSPC changed.
CPC2206: Ownership of object QACPTEMP01 in QTEMP type *USRSPC changed.
CPC2206: Ownership of object QCFT209659 in QTEMP type *USRSPC changed.
CPC2206: Ownership of object Q2F9FF02 in QTEMP type *FILE changed.
CPC2959: 2 records copied to member TESTSH.
CPC2206: Ownership of object QZSHSYSTEM in QTEMP type *USRSPC changed.
$

Contents of /rob/testsh
************Beginning of data
A,B
C,D
************End of Data******

Contents of ROB/TESTSH table
....+....1
COL1 COL2
A B
C D
********


Rob Berendt

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.