PDA

View Full Version : QCMDEXC CPF0006



tarkusch
09-01-13, 12:51
Ich finde den Grund des Fehlers nicht, trotz der Recherche in diesem Forum.


Den kompletten Befehl kann ich auf der AS/400 absetzen,
aber im Programm tritt ein Fehler auf.
CRTSNDMDAV ACCOUNT(AS400)
TO('bernhard.tarkusch@gmail.com')
SUBJECT('Pgm-Fehlermeldung')
TEXT('Fehler(0013) im Programm
aufgetreten!')

Kann mir jemand einen Tip geben?


DQCMDEXEC PR EXTPGM('QCMDEXC')
D CMDTXT 1000A CONST OPTIONS(*VARSIZE)
D CMDLEN 15P 5 CONST
D*
D CMDTXT S 1000A
D CMDLEN S 15P 5
D HK C Const('''') Hochkomma
D $$TEXT S 512A
************************************************** **************
* Hauptprogramm *MAIN
************************************************** **************
/Free
$$Text = 'Fehler(0013) im Programm aufgetreten!';
CMDTXT = 'CRTSNDMDAV ACCOUNT(AS400) TO(' + HK +
'bernhard.tarkusch@gmail.com' + HK +
') SUBJECT(' + HK + 'Pgm-Fehlermeldung' + HK +
') TEXT(' + HK + '@TXT' + HK + ')';
CMDTXT = %replace(%Trimr($$TEXT):CMDTXT:%scan('@TXT':CMDTXT ):4);

MONITOR;
QCMDEXEC(CMDTXT:CMDLEN);
ON-ERROR *ALL;
Msgbox(PGMSDS);
ENDMON;

*INLR= *ON;
Return;


Gruß und Dank im Voraus

Tarki

Pikachu
09-01-13, 13:08
Du mußt CMDLEN vor dem Aufruf auf einen geeigneten Wert setzen!

tarkusch
09-01-13, 13:20
thx,

das habe ich wieder völlig übersehen.

kitvb1
09-01-13, 13:23
CMDTXT = %replace(%Trimr($$TEXT):CMDTXT:%scan('@TXT':CMDTXT ):4);
Just out of interest, you want to send an email describing the error when a program crashes, right? You have the text which is 512A long, but you are only sending 4 characters of that text. Is that intentional? If not, shouldn't that be as follows?
CMDTXT = %replace(%Trimr($$TEXT):CMDTXT:%scan('@TXT':CMDTXT ):%len(%Trimr($$TEXT)) );

tarkusch
09-01-13, 13:31
Just out of interest, you want to send an email describing the error when a program crashes, right? You have the text which is 512A long, but you are only sending 4 characters of that text. Is that intentional? If not, shouldn't that be as follows?
CMDTXT = %replace(%Trimr($$TEXT):CMDTXT:%scan('@TXT':CMDTXT ):%len(%Trimr($$TEXT)) );


Yes, i want to send an email with the error.
But i want to replace @TXT with the $$TEXT-String.

I must give the length of @txt and that is four, or?

kitvb1
09-01-13, 13:51
Ja, der letzte Parameter (4) ist die Anzahl der Zeichen, die Du ersetzen möchtest.
Yes, the last parameter (4) is the number of characters you want to replace.