Re: QJOSJRNE API: ILE/C example needed (better with key 7 - IFS)
Jevgeni Astanovski <[email protected]>
| Newsgroups | gmane.comp.lang.as400.c |
|---|---|
| Message-ID | <CAJuVQr1sHcEcuXDvYqL3WpnaOc9d6EGbAnjF54azwttoGLzj+Q@mail.gmail.com> |
Zvi, just an observation, because I tried your program by copy/paste. In the statement char objName[10] = "MYJRN " ; you only initialize 8 chars in objName, instead of 10. My copy-pasted crashed saying Object MYJRN in library QGPL not found. After adding 2 spaces - ended successfully.... Did not check what it did, but it did not crash at least.... Jevgeni. On Sun, Oct 15, 2017 at 11:38 AM, Zvi Kave <[email protected]> wrote: > Alan, > > Your solution is good if I shall fail with QJOSJRNE API because it is in > Real-Time application. > Can you send me your CL script , because I do not know how to use CL > with > arguments > as subroutine from ILE C ? > > Thank you, > > Zvi > > On 13/10/2017 21:51, Alan Campin wrote: > > I tried the same thing and everything I tried crashed also. What I did > find > was that I was able to do a SNDJRNE to an object path without an issue. > Worked fine. > > May I suggest you just use ILE. Create an CL module and put your SNDJRNE > in > the CL module and bind to a C module. Lot simpler than trying to get API > to > work. > > On Mon, Oct 9, 2017 at 11:15 PM, Zvi Kave [1]<[email protected]> wrote: > > > Hi Mark, > > You are right. I realized that the code I wrote crashes. > But because it was not used actually until now, no one complained. > I need small ILE C example to see how it worked correctly (V5R3 or > higher). > I am sure that the following code that I used is not good, but it is > better if you have a working example. > > #include <stdio.h> > #include <string.h> > #include <qjosjrne.h> > #include <qusec.h> > > typedef struct { > int fillerx; > int num_rec; > int object_type; /* = 7 */ > int object_len; /* = 100 - path name length */ > char *ppath; > } JE_INFO ; > union rec > { > JE_INFO je_info; > char rbuf[256]; > }; > union rec urec; > typedef struct { > int ccsid; /* = 0 */ > char country_id[2]; /* = x'0000' */ > char language_id[3]; /* = x'000000' */ > char reserved3[3]; > int path_type_indicator; /* = 0 */ > int path_len; /* = 19 */ > char path_delimiter[2]; /* = '/' */ > char reserved10[10]; /* = x'0000...00' */ > char path_name[19]; > } PATH_NAME; > PATH_NAME path_st; > jr_write(char *entryData) > { > Qus_EC_t errCode; > int rc; > int size; > char objName[10] = "MYJRN " ; > char objLibrary[10] = "QGPL "; > char qualName[20]; > short int entryDataLen = 0; > char *pErrCode = (char *) &errCode; > sprintf(qualName, "%10.10s%10.10s", objName, objLibrary); > /* entryDataLen = sprintf(entryData, "%s", "Good Luck"); */ > entryDataLen = strlen (entryData); > urec.je_info.ppath = (char *) &path_st.ccsid; > urec.je_info.fillerx = 0; /* to avoid file name */ > urec.je_info.num_rec = 1; > urec.je_info.object_type = 7; > urec.je_info.object_len = 51; > path_st.ccsid = 0; > memset (path_st.country_id, 0, 2); > memset (path_st.language_id, 0, 3); > memset (path_st.reserved3, 0, 3); > path_st.path_type_indicator = 0; > path_st.path_len = 19; > memcpy (path_st.path_delimiter, "/ ", 2); > memset (path_st.reserved10, 0, 10); > memcpy (path_st.path_name, > "/SMZVDTA/log/av.log", > path_st.path_len); > errCode.Bytes_Provided = 0; > errCode.Bytes_Available = 0; > QJOSJRNE(qualName, urec.rbuf, entryData, entryDataLen, > pErrCode); > } > > Thanks, > > Zvi > > On 08/10/2017 18:59, Mark S Waterbury wrote: > > Zvi: > > You asked exactly the same question almost 12 years ago, on > 17-Nov-2005, > on this very list ... :-o > > What kind of "difficulties" are you having? Error messages? At > compile-time or at run-time? What version/release of OS/400 or IBM > i? > > Perhaps if you posted a small snippet or example of source code to > show what you are trying to do, then someone might be able to assist? > > Mark S. Waterbury > > > On 10/8/2017 11:05 AM, Zvi Kave wrote: > > I have dificulties to use QJOSJRNE API key 7 (with IFS path > name) > in > ILE/C. > If someone can send me an example, I shall appreciate it very > much. > > Regards, > > Zvi > -- > This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) > mailing list > To post a message email: [2]C400-L-Zwy7GipZuJhWk0Htik3J/[email protected] > To subscribe, unsubscribe, or change list options, > visit: [3]https://lists.midrange.com/mailman/listinfo/c400-l > or email: [4]C400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected] > Before posting, please take a moment to review the archives > at [5]https://archive.midrange.com/c400-l. > > References > > Visible links > 1. mailto:[email protected] > 2. mailto:C400-L-Zwy7GipZuJhWk0Htik3J/[email protected] > 3. https://lists.midrange.com/mailman/listinfo/c400-l > 4. mailto:C400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected] > 5. https://archive.midrange.com/c400-l > -- > This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) > mailing list > To post a message email: C400-L-Zwy7GipZuJhWk0Htik3J/[email protected] > To subscribe, unsubscribe, or change list options, > visit: https://lists.midrange.com/mailman/listinfo/c400-l > or email: C400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected] > Before posting, please take a moment to review the archives > at https://archive.midrange.com/c400-l. > > -- This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list To post a message email: C400-L-Zwy7GipZuJhWk0Htik3J/[email protected] To subscribe, unsubscribe, or change list options, visit: https://lists.midrange.com/mailman/listinfo/c400-l or email: C400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected] Before posting, please take a moment to review the archives at https://archive.midrange.com/c400-l.