|
Frank, When you are building AS400CMD, you are exceeding the max length of AS400CMD because none of the component strings are VARYING. Either add VARYING to some of the sub-fields (namely EMAILBODY, which is 450 of your total 500 bytes) or make you AS400CMD field bigger. Eric DeLong Sally Beauty Company MIS-Project Manager (BSG) 940-898-7863 or ext. 1863 -----Original Message----- From: fkany@xxxxxxxxxxxxxxxxxx [mailto:fkany@xxxxxxxxxxxxxxxxxx] Sent: Friday, May 30, 2003 2:08 PM To: RPG400-L@xxxxxxxxxxxx Subject: Maximum size for Varying length field Is there a maximum size for a program field when using the Varying keyword? I get an error message when the program below trys to execute the call to QCMDEXC in the SNDEMAIL subroutine. The error message says something about how the varying length field might be too long. This is my first program using embedded SQL. Did I code it right? I tried following the "Using SQL in RPG Programs: An Introduction" guide by Susan M. Gantner from Partner400. I like the guide. I'm going to keep it around awhile until I get more familiar with using embedded SQL. TIA, Frank ****************************************************************** * * FAX log file FQAFFTLOG IF E DISK * D WKLOOP01 S 1A * D P1DATE S 8A D P1FAXNBR S 12A D P1USER S 10A D P1EMAIL S 40A VARYING * D DATE S 8A D FAXNBR S 12A D USER S 10A D STATUS S 1A * D CMDPART1 S 29A D CMDPART2 S 8A D CMDPART3 S 9A D CMDPART4 S 1A D EMAILSUBJ S 31A D EMAILBODY S 245A * D COUNTER S 4S 0 * D AS400CMD S 500A VARYING D CMDLENGTH S 15P 5 * D AS400CMD2 S 10 D CMDLENGTH2 S 15P 5 * * --------------------- * Start Main Processing * --------------------- C EXSR MAINPRCS * * ------------------- * End Main Processing * ------------------- C EVAL *INLR = *ON C RETURN * ****************************************************************** * Main Processing Subroutine * ****************************************************************** C MAINPRCS BEGSR * * C EVAL COUNTER = *ZEROS C EVAL WKLOOP01 = 'Y' C DOU WKLOOP01 = 'N' * * Only Process a Maximum of 4 times C EVAL COUNTER = COUNTER + 1 C IF COUNTER >= 4 C EXSR SNDEMAIL C LEAVE C ENDIF * * Wait 3 minutes C EVAL AS400CMD2 = 'DLYJOB 180' C EVAL CMDLENGTH2 = 10 C CALL 'QCMDEXC' CMDPARMS2 * * Find row from table(QAFFTLOG) C/EXEC SQL C+ SELECT QFCDAT, QFDEST, QFUSER, QFSU C+ INTO :DATE, :FAXNBR, :USER, :STATUS C+ FROM QFAX/QAFFTLOG C+ WHERE QFCDAT = :P1DATE AND QFDEST = :P1FAXNBR AND C+ QFUSER = :P1USER C/END-EXEC * * Did NOT find Row; Process again C IF STATUS = *BLANK C ITER C ENDIF * * Fax Successful C IF STATUS = 'S' C LEAVE C ENDIF * * Fax Unsuccessful C IF STATUS = 'U' C EXSR SNDEMAIL C LEAVE C ENDIF * C ENDDO * C ENDSR * ****************************************************************** * SNDEMAIL - Sends "Failed Fax" Email to User ****************************************************************** C SNDEMAIL BEGSR * /FREE CMDPART1 = 'SNDDST TYPE(*LMSG) TOINTNET(('; CMDPART2 = ')) DSTD('; CMDPART3 = ') LONGMSG('; CMDPART4 = ')'; EMAILSUBJ = 'Your Fax to' + '(' + %SUBST(P1FAXNBR:3:3) + ')' + %SUBST(P1FAXNBR:6:3) + '-' + %SUBST(P1FAXNBR:9:4) + ' Failed'; EMAILBODY = 'Your Fax to' + '(' + %SUBST(P1FAXNBR:3:3) + ')' + %SUBST(P1FAXNBR:6:3) + '-' + %SUBST(P1FAXNBR:9:4) + ' Failed. ' + 'Call the customer and ask if they have ' + 'received the fax you had tried to send. If not,'+ ' make sure the fax number is correct. Then ' + 'resubmit the fax through the same program that ' + 'it was sent or detach the copies that were sent '+ 'to your email address and print them out and ' + 'fax them manually.'; AS400CMD = CMDPART1 + P1EMAIL + CMDPART2 + EMAILSUBJ + CMDPART3 + EMAILBODY + CMDPART4; CMDLENGTH = %LEN(%TRIM(AS400CMD)); /END-FREE * C CALL 'QCMDEXC' CMDPARMS * C ENDSR * ****************************************************************** * *INZSR ****************************************************************** C *INZSR BEGSR * C *ENTRY PLIST C PARM P1DATE C PARM P1FAXNBR C PARM P1USER C PARM P1EMAIL * C CMDPARMS PLIST C PARM AS400CMD C PARM CMDLENGTH * C CMDPARMS2 PLIST C PARM AS400CMD2 C PARM CMDLENGTH2 * C ENDSR * ****************************************************************** _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.