× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



The system function (being from C) uses C conventions for strings.  The
first null in the string signals the end of the string.  The
Options(*String) simply tell the compiler to append a final null at the end
of the passed character variable.  In your case, you had a null in the
string before the end of your data, causing the System function to ignore
the rest of your command.

Eric DeLong
Sally Beauty Company
MIS-Project Manager (BSG)
940-297-2863 or ext. 1863



-----Original Message-----
From: rob@xxxxxxxxx [mailto:rob@xxxxxxxxx]
Sent: Thursday, February 24, 2005 4:23 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Nulls not allowed in a string in system()


               'Msg_Data: ' + %trim(Excp_Data) + '<EOL>' +
When I add that above line in the middle of
             cmd2='?SNDEMEMC GROUP(PROGRAMING) SUBJECT(' + apos +
               eSubject + apos + ') MESSAGE(' + apos +
               eMessage                        + '<EOL>' +
               'Msg_Id  : ' + %trim(Excp_Msg)  + '<EOL>' +
               'Msg_Data: ' + %trim(Excp_Data) + '<EOL>' +
               'Job     : ' + %trim(Job_Name)  + '<EOL>' +
               'User    : ' + %trim(User)      + '<EOL>' +
               'Number  : ' + %trim(Job_NumA)  + '<EOL>' +
               'Routine : ' + %trim(Routine)   + '<EOL>' +
               'Module  : ' + %trim(Proc_Mod)  + '<EOL>' +
               'Program : ' + %trim(Proc_Pgm)  + '<EOL>' +
               'Src_Lib : ' + %trim(Src_Lib)   + '<EOL>' +
               'Src_File: ' + %trim(Src_File)  + '<EOL>' +
               'Src_Mbr : ' + %trim(Src_Mbr) +
               apos + ')';
Is when it hurls with:
A matching apostrophe not found. 
A matching parenthesis not found.

EVAL excp_data :x
00000000 D2C9C3D2 C2D6D6E3 E8405CD3   - ....KICKBOOTY *L
...
Is it the imbedded space, or the nulls?
And why should it give a rat's...?

Contents of cmd2:
 ....5...10...15...20...25...30...35...40...45...50...55...60 
'?SNDEMEMC GROUP(PROGRAMING) SUBJECT('test') MESSAGE('test<EO'
'L>Msg_Data:     KICKBOOTY *LIBL<EOL>Msg_Id  : CPD0032<EOL>Jo'
'b     : ROBS3<EOL>User    : ROBB13<EOL>Number  : 582764<EOL>'
'Routine : QCMDEXC<EOL>Module  : TSTEH01<EOL>Program : TSTEH0'
'1<EOL>Src_Lib : ROB<EOL>Src_File: QPGMSRC<EOL>Src_Mbr : TSTE'
'H01')                                                       '

I think it's the nulls.  Because I can copy that from debug (5250) and 
paste that into 
CALL QCMD F11-For big screen, and smoosh it back together and it works. 
Remember, when you copy from 5250, back into 5250, any nulls are turned 
into spaces because nulls don't display on the screen.

To verify it isn't a total length thing, I tried
             cmd2='?SNDEMEMC GROUP(PROGRAMING) SUBJECT(' + apos +
               'test' + apos + ') MESSAGE(' + apos +
               'test'                          + '<EOL>' +
               'Msg_Id  : ' + %trim(Excp_Msg)  + '<EOL>' +
               'xxxxxxxxx1xxxxxxxxx2xxxxxxxxx3xxxxxxxxx4' + '<EOL>' +
               'Job     : ' + %trim(Job_Name)  + '<EOL>' +
               'User    : ' + %trim(User)      + '<EOL>' +
               'Number  : ' + %trim(Job_NumA)  + '<EOL>' +
               'Routine : ' + %trim(Routine)   + '<EOL>' +
               'Module  : ' + %trim(Proc_Mod)  + '<EOL>' +
               'Program : ' + %trim(Proc_Pgm)  + '<EOL>' +
               'Src_Lib : ' + %trim(Src_Lib)   + '<EOL>' +
               'Src_File: ' + %trim(Src_File)  + '<EOL>' +
               'Src_Mbr : ' + %trim(Src_Mbr) +
               apos + ')';
             ErrorFlag=system(%trim(cmd2));
and that worked fine.

Workaround might be to xlate nulls into blanks.
Let me guess, is it because our prototype for system() is
     D System          PR            10I 0 ExtProc('system')
     D  CmdText                        *   Value Options(*String)
and that *string says first null indicates end of command, right?

Rob Berendt
-- 
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com

-- 
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 thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.