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



On 18-May-2017 15:27 -0600, Gerald Magnuson wrote:
I am trying to get my group job to spawn....

my RPGLE program does:

// Commnd = CALL XYZ9CL PARM(' ' ' ' X'000F' X'00000F')

Commnd = %xlate(AP:QUOTE:Commnd) ;
// turn the single quotes to double quotes....

The terms "single quotes" and "double quotes", esp. in conjunction, are ambiguous, at best. FWiW, the terms Apostrophe and Quotation Mark are well-defined for describing [and probably more universally understood to be], respectively, the parenthetical characters that follow:
(') and (")

If the entity named AP represents the Apostrophe (') character and the entity named QUOTE represents the Quotation Mark character, then understand that the Control Language requires the former [i.e. the apostrophe], as the character string delimiter.


cmmnd = 'CHGDTAARA DTAARA(*GDA) VALUE(' + AP +
%trim(Commnd) + AP + ')' ;
#ExcCmd(%trim(cmmnd)
:%Len(%Trim(cmmnd))) ;

so when I get to my CL program that reads the *GDA, it doesn't like
the double quotes......

If "double quotes" refers to the quotation mark (") character, then, indeed, the CL interpreter will "not like" the use of an unsupported character string delimiter.

and I can't find a way to %xlate the quotes in CLLE...

For OPM, there has long been the Convert Data (QDCXLATE) API program; requires an external Table (*TBL) object however. For ILE CL there is the xlatewt from the QC2UTIL1 Service program (SRVPGM) that can pass the "table" as a string; e.g. the following source shows both:

dcl &rcv *char 11
dcl &src *char 11 value('O''Donovan''s')
/* Note: Following string can be used to CRTTBL APOSTROPHE */
dcl &tbl *char 256 value(x'+
000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F+
202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F+
404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F+
606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7F7E7F+
808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9F+
A0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF+
C0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF+
E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF+
')
dcl &lenDec *dec (5 0) 11
ile: callprc prc('xlatewt') parm((&rcv) (&src) (&tbl))
dmpclpgm
dspsplf qppgmdmp splnbr(*last) /* &rcv=O"Donovan"s */
chgvar &src value('O''Donovan''s')
opm: call QDCXLATE (&lenDec &src 'APOSTROPHE')
dmpclpgm
dspsplf qppgmdmp splnbr(*last) /* &src=O"Donovan"s */


it seems like I am doing it wrong in the RPG turning the single
quotes to double quotes?

any ideas???

The likely intent, as I infer, is to "escape" the apostrophe characters with an apostrophe; i.e. to "double" the apostrophes. The "translate character" features will simply replace one character with another; i.e. no capability for doubling specific characters.

If so, then perhaps the following could illuminate:

d Commnd s 52a varying
d CmdXlate s 52a varying
d CmdScanRpl s 52a varying
d Cmmnd s 100a varying
d CmmndPtr s * inz(%addr(Cmmnd))
d CmmndStruc DS based(CmmndPtr)
d Cmmnd0 5i00
d Cmmnd1 50a
d Cmmnd2 50a
d pos s 5u00
d AP C ''''
d AP2 C ''''''
d QUOTE C '"'
D #ExcCmd pr extpgm('QCMDEXC')
D theCmd 2000 const
D theCmdLen 15p05 const
/free
dsply 'Starting a new iteration of test' ;
// set original cmdStr
Commnd = '?CALL X9CL ('' '' '' '' X''000F'' X''00000F'')' ;
//Eval Commnd = CALL X9CL (' ' ' ' X'000F' X'00000F')
dsply Commnd ;
// CmdRqs to set _original_ cmdStr into *LDA
cmmnd = '?CHGDTAARA DTAARA(*LDA) VALUE(' + AP +
%trim( Commnd ) + AP + ')' ;
dsply Cmmnd1 ;
dsply Cmmnd2 ;
Monitor ; // ignore any errors; request will fail!
#ExcCmd(cmmnd:%len(cmmnd)) ;
on-error ; // show joblog with cpd0020 and cpf0001
#ExcCmd('dspjoblog':9) ;
EndMon ;
// turn the single quotes to double quotes....
CmdXlate = %xlate(AP:QUOTE:Commnd) ;
dsply CmdXlate ;
// CmdRqs to set _translated_ cmdStr into *LDA
cmmnd = '?CHGDTAARA DTAARA(*LDA) VALUE(' + AP +
%trim( CmdXlate ) + AP + ')' ;
dsply Cmmnd1 ;
dsply Cmmnd2 ;
#ExcCmd(cmmnd:%len(cmmnd)) ; // issue ChgDtaAra
#ExcCmd( 'dspdtaara *lda' // issue DspDtaAra
:%Len('dspdtaara *lda' ) ) ;
// Escape the apostrophes; rpl each apost w/ two
CmdScanRpl = %scanrpl(AP:AP2:Commnd) ;
dsply CmdScanRpl ;
// CmdRqs to set _scan+replaced_ cmdStr into *LDA
cmmnd = '?CHGDTAARA DTAARA(*LDA) VALUE(' + AP +
%trim( CmdScanRpl ) + AP + ')' ;
dsply Cmmnd1 ;
dsply Cmmnd2 ;
#ExcCmd(cmmnd:%Len(cmmnd)) ; // issue ChgDtaAra
#ExcCmd( 'dspdtaara *lda' // issue DspDtaAra
:%Len('dspdtaara *lda' ) ) ;
*inlr = *on ;
/end-free



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.