Exécuter Programme CL par Store procédure
Bonjour à tous,
Ce que je veux faire est de d'envoyer le résultat du WRKACTJOB dans un PF pour pouvoir le manipuler en SQL. Je veux que tous se fasse à partir d'une connection ODBC, pas d'écran verte et noir.
Voici la situation :
J'ai créé un programme CL qui se lit comme suit (Code pris sur le net):
Code:
1 2 3 4 5 6 7 8 9 10
| PGM
OVRPRTF FILE(QPDSPAJB) HOLD(*YES)
WRKACTJOB OUTPUT(*PRINT)
CRTPF FILE(CANADA6/ACTJOBPRT) RCDLEN(132)
MONMSG MSGID(CPF0000)
CPYSPLF FILE(QPDSPAJB) TOFILE() +
SPLNBR(*LAST)
DLTSPLF FILE(QPDSPAJB) SPLNBR(*LAST)
DLTOVR FILE(QPDSPAJB)
ENDPGM |
Ce petit programme copy tous ce qu'il y à dans le WRKACTJOB dans un PF qui est CANADA6/ACTJOBPRT.
Quand le fais call pgm(actjob) sur la ligne de commande du AS/400, ça fonctionne très bien. Et je suis capable de le manipuler en SQL. Parfait c'est exactement ça que je veux.
Bien, alors j'ai créé une store procédure pour appeler ce CL qui se lit comme suit :
Code:
1 2 3 4 5
| CREATE PROCEDURE canada6.sactjob
RESULT SETS 0
EXTERNAL NAME qgpl.actjob
LANGUAGE CL
PARAMETER STYLE GENERAL; |
Cette store procédure appel seulement le programme CL.
Quand je suis dans STRSQL sur le AS/400 et que je fais call canada6.sactjob ça fonctionne très bien.
Le but ultime est d'être capable de la partir depuis SQL en ODBC, mais ça fonctionne pas, j'ai toujours cette erreur :
Citation:
SQL State: 38501
Vendor Code: -443
Message: [SQL0443] Trigger program or external routine detected an error. Cause . . . . . : Either a trigger program, external procedure, or external function detected and returned an error to SQL. If the error occurred in a trigger program, the trigger was on table ACTJOB in schema QGPL. If the error occurred in an external procedure or function, the external name is ACTJOB in schema QGPL. The associated text is *N. If the error occurred in a trigger program, the associated text is the type of trigger program. If the error occurred in an external function, the associated text is the text of the error message returned from the external function. Recovery . . . : Refer to the joblog for more information regarding the detected error. Correct the error and try the request again.
Je ne comprend pas pourquoi, si quelqu'un un une idée se serais très très très aprécié...
P.S: l'utilisateur n'as pas access à l'écran verte et noir.
Merci d'avance
Bizz