[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Contact ID: 122561 - Is it possible to call an SQR program from another SQR program?



Yes,

Use the call system command
 and example is provided in the faq.txt file.

---------------------------- Example code ends here
----------------------------
================================================================================
 Q: Can I use 'dynamic column names' in Begin-Select (versions prior to
v3.0)?
 A: Yes, see following workaround. This SQR report will actually write
another
    SQR code with column names supplied by the user and execute it. Note
that
    in SQR Version 3.0, dynamic columns are directly supported.

---------------------------- Example code begins here
--------------------------
begin-report
 do main
end-report

begin-procedure main
 move 'DEPTNO' to $col1 ! You might use INPUT here to prompt the user
 move 'ENAME'  to $col2 ! to enter the column and table names instead.
 move 'EMP'    to $tab
 move 'sqrout.sqr' to $sqrpgmnam
 let $syscmd = 'sqr '||$sqrpgmnam||' user/password'
 move 100 to #flatfileid
 open $sqrpgmnam as #flatfileid for-writing record=132
 write #flatfileid from 'BEGIN-REPORT'
 write #flatfileid from '       DO MAIN'
 write #flatfileid from 'END-REPORT'
 write #flatfileid from 'BEGIN-PROCEDURE MAIN'
 write #flatfileid from 'BEGIN-SELECT'
 write #flatfileid from $col1 ' (+1,1)'
 write #flatfileid from $col2 ' (,30)'
 write #flatfileid from 'from ' $tab
 write #flatfileid from 'END-SELECT'
 write #flatfileid from 'END-PROCEDURE MAIN'
 close #flatfileid
 call system using $syscmd #status
 display 'Status of call is ' noline
 display #status
end-procedure


Davi Cabral wrote:
>
> Dear Sirs,
>
> Is it possible to call an SQR program from another SQR program?
> I didn`t find anything about this on the manuals.
>
> Thank you,
>
> Davi Cabral
begin:          vcard
fn:             Franck Masson
n:              ;Franck Masson
org:            Brio Technology EMEA
adr;dom:        Le capitol;;55 av. des champs Pierreux;Nanterre;92000;;
email;internet: franck.masson@brio.com
title:          Sales Manager Northern Europe
tel;work:       33 1 55 69 36 00
tel;fax:        33 1 47 25 02 59
tel;home:       Mobile : 33 6 84 80 17 05
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
version:        2.1
end:            vcard