|
Quello che segue e' il metodo comune per gestire i parametr sulle query standard, quello in allegato e' tramite la definizione via QMQRY usando pero' dei source. Spero che ti possa aiutare. Marco Facchinetti --- Peter Vidal <Peter_Vidal@xxxxxxxx> wrote: > First, you need to define your Query/400. On the SELECT > RECORDS Screen, > you need to use a colon (:) to qualify the fields as > follows: > > Select Records > Type comparisons, press Enter. Specify OR to start > each new group. > Tests: EQ, NE, LE, GE, LT, GT, RANGE, LIST, LIKE, IS, > ISNOT... > > AND/OR Field Test Value (Field, Number, > 'Characters', or > ...) > DATE1 EQ :USERDATE1 > AND DATE2 EQ :USERDATE2 > > > A second screen will pop-up: (You can specify any file > in use by the > query) > > Specify Dependent Value Qualifiers > > Type choices, press Enter. > > Qualifier type . . . . 2 1=Query, 2=File > > > Query or file . . . . UNCFORDS Name, F4 for > list of files > Library . . . . . . PRODLIB Name, *LIBL, F4 > for list > > For choice 2=File: > File member . . . . *FIRST Name, *FIRST, > F4 for list > > Second, on a CL, use STRQMQRY command to run the query as > follows: > > STRQMQRY > QMQRY(Library_Name/QRYDFN_Name) ALWQRYDFN(*YES) > SETVAR((DATE1 &SCRDATE1) (DATE2 &SCRDATE2)) > > NOTE: Work fields must be type *CHAR, no matter > that the field is a number > on the query. > > > Hope this helps, > > Peter Vidal > PALL Aeropower Corporation > SR Programmer Analyst > 5775 Rio Vista Drive > Clearwater, FL 33760-3137 > (727)539-8448 > www.pall.com > > "My religion consists of a humble admiration of the > illimitable superior > spirit who reveals himself in the slight details we are > able to perceive > with our frail and feeble mind." > Albert Einstein > > -- > This is the Midrange Systems Technical Discussion > (MIDRANGE-L) mailing list > To post a message email: MIDRANGE-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: > http://lists.midrange.com/mailman/listinfo/midrange-l > or email: MIDRANGE-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the > archives > at http://archive.midrange.com/midrange-l. > > __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail
Questo è il source di una definizione un pochino più complessa delle altre:
Colonne . . . : 1 79 Esame
METAILEO/SQL
SEU==>
CABCOMTIF
FMT ** ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
...+...
****************** Inizio dati
******************************************************************************************
0001.00 select tacodice , tadscabina, tpdescri40, ticodice, tidstipute,
020711
0002.00 count(ascdutente)
020711
0003.00 from tabcab0f, dbsto01l, dbana01l, tabpae0f, tabcom0f, tabtip0f,
tabtif0f 020711
0004.00 where abstatorec = ' ' and
011206
0005.00 (abdtfinero is null or abdtfinero > &DATAA ) and
011206
0006.00 (abdtiniero is not null and abdtiniero <= &DATAA )
011213
0007.00 and tlcdtiputf = ticodice
020711
0008.00 and ascdtiputi = tlcodice
020711
0009.00 and tfcdcomune = tpcodice
020711
0010.00 and abcdpaese = tfcodice
020711
0011.00 and ascdutente = abcdutente
020711
0012.00 and asseqstori = abprcondiz
020711
0013.00 and tacodice = ascdcabina
020711
0014.00 group by tadscabina, tacodice, tpdescri40, ticodice, tidstipute
020711
0015.00 order by tadscabina, tacodice, tpdescri40, ticodice, tidstipute
020711
******************** Fine dati
******************************************************************************************
Tutta la parte dove vedi (X)SQLFORM è relativo alla formattazione in stampa!!
e il CL che lo esegue:
XSQLPARM: PGM PARM(&DATA &MEMBRO &STAMPA &LARG) /* Crea ed +
esegue un statement SQL memorizzato nel +
membro richiesto del file SQL della +
libreria METAILEO, passa un parametro. */
DCL VAR(&D1) TYPE(*CHAR) LEN(8)
DCL VAR(&D2) TYPE(*CHAR) LEN(10)
DCL VAR(&DATA) TYPE(*CHAR) LEN(10)
DCL VAR(&MEMBRO) TYPE(*CHAR) LEN(10)
DCL VAR(&STAMPA) TYPE(*CHAR) LEN(1)
DCL VAR(&LARG ) TYPE(*CHAR) LEN(1)
DCL VAR(&STRINGA) TYPE(*CHAR) LEN(100)
DCL VAR(&FORM) TYPE(*CHAR) LEN(10) VALUE('*SYSDFT')
CVTDAT DATE(&DATA) TOVAR(&D1) FROMFMT(*EUR)
CHGVAR VAR(&D2) VALUE('''' *TCAT &D1 *TCAT '''')
CHGVAR VAR(&STRINGA) VALUE(&DATA)
/* crea il query da eseguire */
DLTQMQRY QMQRY(METAILEO/XSQL)
MONMSG MSGID(CPF0000)
DLTQMFORM QMFORM(METAILEO/XSQLFORM)
MONMSG MSGID(CPF0000)
CRTQMQRY QMQRY(METAILEO/XSQL) SRCFILE(METAILEO/SQL) +
SRCMBR(&MEMBRO) AUT(*ALL)
/* se presente abbina form */
RTVMBRD FILE(METAILEO/SQLFORM) MBR(&MEMBRO)
MONMSG MSGID(CPF9815) EXEC(GOTO CMDLBL(NOFORM))
DLTQMFORM QMFORM(METAILEO/XSQLFORM)
MONMSG MSGID(CPF0000)
/* Si lavora sempre su un membro di lavoro */
CPYF FROMFILE(SQLFORM) TOFILE(SQLFORM) +
FROMMBR(&MEMBRO) TOMBR(XSQLFORM) +
MBROPT(*REPLACE)
/* imposta la data nel titolo della stampa */
OVRDBF FILE(SQLFORM) MBR(XSQLFORM)
CALL PGM(CL01) PARM(&STRINGA)
DLTOVR FILE(SQLFORM)
MONMSG MSGID(CPF0000)
CRTQMFORM QMFORM(METAILEO/XSQLFORM) +
SRCFILE(METAILEO/SQLFORM) +
SRCMBR(XSQLFORM) AUT(*ALL)
CHGVAR VAR(&FORM) VALUE('XSQLFORM')
NOFORM: IF COND(&STAMPA *NE 'S') THEN(STRQMQRY +
QMQRY(METAILEO/XSQL) QMFORM(&FORM) +
SETVAR((DATAA &D2)))
ELSE CMD(DO)
IF COND(&LARG *EQ ' ') THEN(OVRPRTF +
FILE(QPQXPRTF) PAGESIZE(*N 132) +
OVRSCOPE(*JOB))
ELSE CMD(OVRPRTF FILE(QPQXPRTF) PAGESIZE(*N 198) +
CPI(15) OVRSCOPE(*JOB))
STRQMQRY QMQRY(METAILEO/XSQL) OUTPUT(*PRINT) +
QMFORM(&FORM) SETVAR((DATAA &D2))
DLTOVR FILE(QPQXPRTF)
MONMSG MSGID(CPF0000)
ENDDO
DLTQMQRY QMQRY(METAILEO/XSQL)
MONMSG MSGID(CPF0000)
DLTQMFORM QMFORM(METAILEO/XSQLFORM)
MONMSG MSGID(CPF0000)
DLTOVR FILE(QPQXPRTF) LVL(*JOB)
MONMSG MSGID(CPF0000)
ENDPGM
La parte che segue è totalmente facoltativa ed è relativa ai FORM
(formattazione per stampa):
H QM4 05 F 01 E V W E R 01 03 02/02/26 18:29
*
* V 1001 = Descrizione query.
V 1001 050 Utenze attive alla data per cabina/comune/tip.ut
*
* T 1110 = Tabella colonne.
* 006 = Numero di record R presenti
* 005 = Numero di coppie di definizioni:
* - La prima indica il tipo di definizione
* - La seconda la lunghezza nel record R
* 1112 = Tipo dati: CHAR NUMERIC
* 1113 = Intestazioni colonne
* 1114 = Utilizzo: BREAKn SUM MIN MAX AVG....
* 1115 = Spazio tra colonne (default 2)
* 1116 = Larghezza colonna
* 1117 = Editazione
* 1118 = Sequenza
T 1110 006 005 1114 010 1116 006 1118 003 1115 003 1113 060
* Utilizzo.. Lenght Seq Spc Intestazione
colonne....................................
R BREAK1 6 1 Codice_cabina
R BREAK1 20 2 1 Descrizione Cabina
R BREAK2 20 3 1 Descrizione Comune
R 2 4 1 Cd_Tp_Fi
R 20 5 1 Tipologia Fiscale
R SUM 18 6 1 Numero_Utenti_Attivi
*
* T 1210 = Tabella intestazione report.
* 003 = Numero di record R presenti
* 003 = Numero di coppie di definizioni:
* - La prima indica il tipo di definizione
* - La seconda la lunghezza nel record R
* 1212 = Numero riga intestazione
* 1213 = Allineamento (LEFT CENTER RIGHT)
* 1214 = Testo.
T 1210 003 003 1212 004 1213 006 1214 055
* Prog Allin. Testo intestazione (& è dove verrà messa la data)
R 1 CENTER *******************************************************
R 2 CENTER * Utenti attivi x Cabina/Comune/Utenza al & *
R 3 CENTER *******************************************************
* Campi V sintassi: V 1201 001 0 (1201=Funzione 001=Len valore 0=Valore)
* Numero di linee blank prima dell'intestazione
V 1201 001 0
* Numero di linee blank dopo l'intestazione
V 1202 001 2
* Numero di linee blank prima del testo fondo pagina
V 1301 001 2
* Numero di linee blank dopo il testo fondo pagina
V 1302 001 0
* Stampare testo fine stampa su nuova pagina.
V 1401 002 NO
* Mettere testo fine stampa a linea ??
V 1402 004 2
* Linee da saltare prima dell stampa del testo finale.
V 1403 006 0
*
* T 1410 = Tabella testo finale stampa
* 001 = Numero di record R presenti
* 003 = Numero di coppie di definizioni:
* - La prima indica il tipo di definizione
* - La seconda la lunghezza nel record R
* 1412 = Numero riga testo fine stampa
* 1413 = Allineamento (LEFT CENTER RIGHT)
* 1414 = Testo.
T 1410 001 003 1412 004 1413 006 1414 055
R 1 RIGHT Totale finale
*************************************************
* OPTIONS *
*************************************************
* 1501 Detail line spacing 1
* 1502 Outlining for break columns YES
* 1503 Default break text YES
* 1505 Column wrapped lines kept on page YES
* 1507 Column heading separators YES
* 1508 Break summary separators YES
* 1510 Final summary separators YES
V 1501 001 1
V 1502 003 YES
V 1503 003 YES
V 1505 003 YES
V 1507 003 YES
V 1508 003 YES
V 1510 003 YES
*************************************************
* BREAK 1
*************************************************
* Break level indicator -
V 3080 001 1
* New page for break heading NO
V 3101 002 NO
* Repeat column headings NO
V 3102 002 NO
* Blank lines before heading 0
V 3103 001 0
* Blank lines after heading 0
V 3104 001 0
* T 3110 = Break heading table 0-5
* 001 = Numero di record R presenti
* 003 = Numero di coppie di definizioni:
* - La prima indica il tipo di definizione
* - La seconda la lunghezza nel record R
* 3112 = Numero riga testo break
* 3113 = Allineamento (LEFT CENTER RIGHT)
* 3114 = Testo.
***** T 3110 001 003 3112 001 3113 007 3114 050
***** R 1 RIGHT Totale cabina
* New page for break footing NO
V 3201 002 NO
* Put break summary at line 1
V 3202 004 1
* Blank lines before footing 0
V 3203 006 0
* Blank lines after footing 1
V 3204 001 1
*
* T 3210 = Break footing table 0-5
* 001 = Numero di record R presenti
* 003 = Numero di coppie di definizioni:
* - La prima indica il tipo di definizione
* - La seconda la lunghezza nel record R
* 3212 = Numero riga testo break
* 3213 = Allineamento (LEFT CENTER RIGHT)
* 3214 = Testo.
T 3210 001 003 3212 001 3213 007 3214 050
R 1 RIGHT Totale cabina di &2
*************************************************
* BREAK 2
*************************************************
* Break level indicator -
V 3080 001 2
* New page for break heading NO
V 3101 002 NO
* Repeat column headings NO
V 3102 002 NO
* Blank lines before heading 0
V 3103 001 0
* Blank lines after heading 0
V 3104 001 0
* T 3110 = Break heading table 0-5
* 001 = Numero di record R presenti
* 003 = Numero di coppie di definizioni:
* - La prima indica il tipo di definizione
* - La seconda la lunghezza nel record R
* 3112 = Numero riga testo break
* 3113 = Allineamento (LEFT CENTER RIGHT)
* 3114 = Testo.
**** T 3110 001 003 3112 001 3113 007 3114 050
**** R 1 RIGHT Totale comune
* New page for break footing NO
V 3201 002 NO
* Put break summary at line 1
V 3202 004 1
* Blank lines before footing 0
V 3203 006 0
* Blank lines after footing 1
V 3204 001 1
*
* T 3210 = Break footing table 0-5
* 001 = Numero di record R presenti
* 003 = Numero di coppie di definizioni:
* - La prima indica il tipo di definizione
* - La seconda la lunghezza nel record R
* 3212 = Numero riga testo break
* 3213 = Allineamento (LEFT CENTER RIGHT)
* 3214 = Testo.
T 3210 001 003 3212 001 3213 007 3214 050
R 1 RIGHT Totale comune di &3
E
E questo è il programmino che va a mettere la data nel source del FORM per poter
far vedere all'utente i parametri selezionati.
/COPY qcpylesrc,hheader1
h**************************************************************************
h* CL01 - Inserisce un campo in un form query nella sezione intestazione. *
h**************************************************************************
fsqlform uf e disk rename(sqlform:sql)
f**************************************************************************
d*****************************************************************
d**** Dichiarazione campi ***
d*****************************************************************
d dati s 100
d len s 4 0
d pos s 4 0
d si c const(*on)
d no c const(*off)
dutility sds
d programma *proc
d utente 254 263
c*
c* Scandisce membro sqlform e cerca la sezione interessata.
c*
c do *hival
c read sql
c if %eof
c leave
c endif
c if %subst(srcdta:1:6)='T 1210'
c*
c* Trovata, scandisce prossime righe, sono ammessi solo commenti o righe tipo
"R"
c* in caso contrario esce e non aggiorna.
c*
c do *hival
c read sql
c if %eof
c leave
c endif
c if %subst(srcdta:1:1)='*'
Commenti, salta.
c iter
c endif
c if %subst(srcdta:1:1)='R'
Record "R" va bene
c eval pos=%scan('&':srcdta) Vede
se trova il
c if pos=0
carattere speciale
c iter
c endif
c if pos+len-1>%len(srcdta) Se
la stringa da in-
c eval len=%len(srcdta)-pos+1
serire è troppo lun-
c endif ga
la ridimensiona.
c eval %subst(srcdta:pos:len)=%trim(dati)
Inserisce
c update sql
Aggiorna.
c leave
c else Non
"R" esce e non
c leave
aggiorna
c endif
c enddo
c*
c endif
c*
c enddo
c eval *inlr=*on
/EJECT
c*********************************************************************************************
c* *INZSR - Partenza standard
*
c*-------------------------------------------------------------------------------------------*
c* Ricezione parametri e verifica autorizzazione all'uso del programma
*
c*-------------------------------------------------------------------------------------------*
c* Parametri passati ricevuti:
*
c* AUTORIZZAZI O - Autorizzazioni concesse
*
c*-------------------------------------------------------------------------------------------*
c* Indicatori utilizzati:
*
c* xx - On Off - Descrizione
*
c*-------------------------------------------------------------------------------------------*
c* Routine richiamate:
*
c* xxxxxxxxxxx - Descrizione
*
c*********************************************************************************************
c *inzsr begsr
c*
c *entry plist
c parm dati
c eval len=%len(%trim(dati))
c*
c endsr
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.