Discussione:
Parametri di un programma
(troppo vecchio per rispondere)
MarcoP
2016-10-18 07:06:40 UTC
Permalink
Buongiorno a tutti

C'è modo di sapere, per un programma CLLE o RPGLE, le caratteristiche
principali (tipo, lunghezza e ordine) dei parametri che riceve?

Thanks
--
Marco
Dr.UgoGagliardelli
2016-10-18 08:28:55 UTC
Permalink
Post by MarcoP
Buongiorno a tutti
C'è modo di sapere, per un programma CLLE o RPGLE, le caratteristiche
principali (tipo, lunghezza e ordine) dei parametri che riceve?
Intendi dentro al programma?
In tal caso puoi solo sapere quanti parametri sono stati passati, per
l'RPG c'e' %parms, per il CL devi ricorrere ad una funzione C, in
pratica un programma C riceve sempre un int che e' il numero di
argomenti, ed un puntatore ad un array di puntatori che sono gli
argomenti stessi. In ogni caso potrai sapere solo il numero e l'ordine.
Il tipo e la lunghezza no, in quanto i parametri ricevuti sono sempre
puntatori void.

Se invece intendi dall'esterno, nella descrizione del programma non c'e'
tipo e lunghezza, ma nel CL c'e' il numero di parametri, mentre nell'RPG
c'e' il numero massimo, che dice poco.
MarcoP
2016-10-19 06:44:36 UTC
Permalink
Dr.UgoGagliardelli <***@me.please> ha scritto:

Il problema è che devo chiamare un programma di cui non ho il sorgente, ma
che più o meno so come funziona e di quali dati ha bisogno. Quello che non
so con certezza è quanti parametri riceva di preciso: ci sono dei nomi
oggetto (quindi lunghi 10) e un flag di un carattere... ma non mi funziona
e da errore per i parametri passati!

Il programma in questione non fa disastri se non funziona correttamente,
quindi potrei fare dei tentativi senza far danni. Ma se sapessi già le
caratteristiche dei parametri il lavoro sarebbe più semplice.
--
Marco
Obelix
2016-10-18 08:41:42 UTC
Permalink
Post by MarcoP
Buongiorno a tutti
C'è modo di sapere, per un programma CLLE o RPGLE, le caratteristiche
principali (tipo, lunghezza e ordine) dei parametri che riceve?
Se intendi 'di programma da chiamare i cui parametri sono sconosciuti'
solo se e' stato compilato con PGMINFO(*PCML *MODULE) o PGMINFO(*PCML
*ALL). o dbgView() diverso da *NONE.

Altrimenti, come detto dal sommo Ugo, puo solo sapere quanti sono i
parametri min e max (il che, fondalmentalmente, dipende IMHO dal fatto
che lui riceve 'n' puntatori, a cosa cazzo puntino non gliene frega
niente...)
CRPence
2016-10-18 15:44:06 UTC
Permalink
Post by MarcoP
C'è modo di sapere, per un programma CLLE o RPGLE, le
caratteristiche principali (tipo, lunghezza e ordine) dei parametri
che riceve?
Such a question might be asked differently; e.g. in the context of
what [specific] problem is trying to be solved. Depending on the
specific context, given the perspective of the inquirer of those
characteristics, then how some details might be determined might be able
to be explained; such as prior replies which establish a context for
their reply given, about gleaning such information.

For example, from a given program, I could suggest that the details
of the parameters are available from the source from which each was
compiled; or better, the listing that was produced when the program was
compiled. Knowing that might be irrelevant from the actual perspective
of the OP, but the information is quite valid more generally.

IIRC, by default, the CL includes Operation Descriptors (OpDesc) for
parameters that are passed. An ILE RPG might have to make an explicit
request, with IIRC the keyword OPDESC coded on the prototype. There is a
CEE API to obtain some information about the parameters via these Op
Desc, and another CEE API for determining which arguments were omitted.

[Retrieve Operational Descriptor Information (CEEDOD) API ]
(http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/apis/CEEDOD.htm)

[Test for Omitted Argument (CEETSTA) API]
(http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/apis/CEETSTA.htm)

Note: Data Pointers store attributes of the data they address;
knowing that might be a place to start, if they seem like something to
pursue.
--
Regards, Chuck
Dr.UgoGagliardelli
2016-10-19 09:34:25 UTC
Permalink
Il 18.10.2016 17.44, CRPence ha scritto:
[..]
Post by CRPence
[Retrieve Operational Descriptor Information (CEEDOD) API ]
(http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/apis/CEEDOD.htm)
[Test for Omitted Argument (CEETSTA) API]
(http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/apis/CEETSTA.htm)
The op should call a program without a known calling interface, that
apis retrieve information from the called program point of view: the
opposite.

Continua a leggere su narkive:
Loading...