×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




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 ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2026 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.