Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: Retrieve Current Server JobNumber

  1. #1
    New Member
    Join Date
    Dec 2003
    Location
    France
    Posts
    26

    Retrieve Current Server JobNumber

    For everybody looking for that (I was !), it will be possible for a batch to retrieve its own JobNumber without searching it hazardously in F986110...

    Indeed, looking in F986110 doesn't work if the report was launched by another report (in the same process ID), because of "ReportInterConnect" insert the record just AFTER the second report is done...

    However, the JobNumber exist in "lpBhvrCom" datastructure of Business Functions. It is hidden under the "lpReportSection" parameter.

    "lpReportSection" seems to be an array of pointers, and the pointer #12 is a pointer to the "UBEVAR" structure used by "jdeLaunchUBEEx" to launch the batch.

    At this point, I have to specify a very important information : I tested this on OneWorld Xe, SP21. It is working on our Server (AIX) and on Local (there is no JobNumber on Local, but there is a lot of other parameters in UBEVAR, such as LogFileName...)
    It is possible that the structure of "lpReportSection" change between our E1 version and yours... You have to test it : if LogFileName is correctly retrieved, it's a win.

    I would have preferred to find THE structure in standards .h E1 files, rather than to recreate it ("tagReportSection" in B5500201.h). But I didn't find it (if you find it : tell me please !)

    I have implemented the possibility of activate the "cCreateCSV" flag by using the "2" value. Use it in "Initialize Report (future)" and the CSV file will be created. Useful to activate CSV by Processing Options for example...
    You can only use this in "Report Level Event Rules" of your report. If you use it in another Event, report will crash (because - I suppose - it want to write to CSV file and this file is not open for output)

    Thanks a lot for this forum !
    Christophe

    Special dedication to Google translate tool ;-). I hope everybody can understand my frenglish...

    4 dec 2007 : added 2 missing DataStructures in the attached file.

    17 may 2011 : added Unicode version of BSFN, added function "RetrieveUbeDataSelection" and UBE R55TEST1 for example of use
    Attached Files Attached Files
    Xe UPDATE 7 SP21, AIX 5.2, Oracle 9.2

  2. #2
    New Member
    Join Date
    Dec 2003
    Location
    France
    Posts
    26

    Retrieve Current Server JobNumber & Control of CSV Output

    I have updated the ZIP file...
    Business Function has now 3 functions :

    * GetCurrentUbeParameters
    Some new parameters added...

    * GetCurrentUbeOutputFiles
    Rebuild LOG, PDF or CSV output file of current job.
    Many thanks to Alex for its hint about 29 chars limitation of FNDFUF2 field.

    * SetResetCurrentUbeCsvOutput
    Switch on or switch off the standard CSV output.
    If you want to switch on, you have to do it in "InitializeReport" Report Level Event. Otherwise UBE will crash because UBE engine open the CSV file just after "InitializeReport", regarding the "CreateCSV" flag. And if it doesn't open the file, it will crash when it will want to write it.


    It's now easy to have a full control on CSV output file :
    1) create "ReportHeader" and "ReportFooter" sections
    2) in "InitializeReportHeader", retrieve the "CreateCSV" flag via "GetCurrentUbeParameters"
    3) if flag is on :
    a) switch off the flag via "SetResetCurrentUbeCsvOutput"
    b) retrieve CSV FileName via "GetCurrentUbeOutputFiles"
    c) open this CSV flat file for output via B34A1010.
    d) optionally, write an header record in this flat file.
    4) in "DoSection" of your main section, write each detail records in flat file (only if "CreateCSV" flag was on, of course !)
    5) in "EndReportFooter", close flat file and switch on the "CreateCSV" flag (only if "CreateCSV" was on...)

    >>> your own CSV file is accessible via WSJ !

    (We have to use "ReportHeader" and "ReportFooter" sections instead of "InitializeReport" and "EndReport" report level events, because UBE engine decide how it will write F986110 AFTER "InitializeReport" and BEFORE "EndReport")

    Christophe
    Xe UPDATE 7 SP21, AIX 5.2, Oracle 9.2

  3. #3
    Member
    Join Date
    Jul 2002
    Location
    FRANCE, Europe
    Posts
    97

    Re: Retrieve Current Server JobNumber & Control of CSV Output

    What a "canaille" this Christophe !
    and what about the other little thing that is hidden somewhere else in the cache my friend ? You remember what thing ?
    Fred
    Frédéric Knies
    8.11, 8.10, ERP8, Xe, B7331
    DB2/400, SQL, Oracle
    Sales - Purchase - Stock - Pricing - Transportation - PM
    FRANCE

  4. #4
    New Member
    Join Date
    Dec 2003
    Location
    France
    Posts
    26

    Re: Retrieve Current Server JobNumber & Control of CSV Output

    Hello everybody

    I'm very chagrined... this does not work on OS/400 (However it's working on Windows and Unix !)

    I suppose that I have misdeclared the undocumented "lpBhvrCom->lpReportSection" structure :

    <font class="small">Code:</font><hr /><pre>
    typedef struct tagReportSection
    {
    void *pPtr01;
    void *pPtr02;
    void *pPtr03;
    void *pPtr04;
    void *pPtr05;
    void *pPtr06;
    void *pPtr07;
    void *pPtr08;
    void *pPtr09;
    void *pPtr10;
    void *pPtr11;
    PUBEVAR pUBEVar; /* tagUBEVAR declared in jdekstrt.h */
    } ReportSection, *LPReportSection;
    </pre><hr />
    Perhaps I have to declare the 11 firsts pointer differently ?

    I don't know enough the AS/400 and, moreover, I do not have any more an access to this system to make tests...

    Is there an AS/400 & C expert to suggest a solution ?

    Thanks
    Christophe
    Xe UPDATE 7 SP21, AIX 5.2, Oracle 9.2

  5. #5
    Member Gov's Avatar
    Join Date
    May 2006
    Location
    Pittsburgh, PA
    Posts
    614

    Re: Retrieve Current Server JobNumber & Control of CSV Output

    Hi Christophe,

    I am using the custom BSFN on E812 to retrieve the current server Job Number. I found only one data structure parameters are included in the ZIP file. Can you please include the other 2 data structure parameters (D5500201B & D5500201C).I want to use the Same alias that you have used.

    Thanks in Advance
    Regards,Gov

    Sr. E1 Technical Consultant | Release : E900 |Tools : 8.98.4.2 , 9.2.0.3| DB2

  6. #6
    New Member
    Join Date
    Dec 2003
    Location
    France
    Posts
    26

    Re: Retrieve Current Server JobNumber & Control of CSV Output

    Hi Gov,

    Sorry if I'm comming so late... too late...
    I can't update the attached file in the main post... So I attach the updated version to my response...

    5 dec 2007 : I had to change the name of the file to attach it to the main post... it is done now...
    Xe UPDATE 7 SP21, AIX 5.2, Oracle 9.2

  7. #7
    New Member
    Join Date
    Dec 2003
    Location
    France
    Posts
    26

    Re: Retrieve Current Server JobNumber on ALL system ???

    Hello everybody,

    I would like the fonction "GetCurrentUbeParameters" work on all system...

    Attached to this message is a ZIP file with a JDE Report and 2 Functions. These allow to "see" the portion of memory where is the undocumented structure "ReportSection".
    Somewhere in this structure is a pointer to "UbeVar" structure.

    Run the batch : the objective is to locate all pointers which are "near" to ReportSection pointer.
    Now you can run the batch with the processing option populate with each offset located.

    If the report found the good "server job number", you win : you have to replace the 11 pointers declared in "tagReportSection" in b5500201.c by an array of chars with the length equal to the offset found.

    On Windows and AIX system, there is 7 pointers and an empty buffer of 16 chars before the UbeVar pointer.
    A pointer is 4 chars (Windows and AIX !) : 7x4 + 16 = 44
    &gt;&gt;&gt; The pointer is at offset 44 of ReportSection Structure !
    (look at the PDF stored in the attached ZIP file)
    <font class="small">Code:</font><hr /><pre>
    typedef struct tagReportSection
    {
    char buf[44];
    PUBEVAR pUBEVar; /* tagUBEVAR declared in jdekstrt.h */
    } ReportSection, *LPReportSection;
    </pre><hr />
    I think you could locate 7 pointers and a buffer on others systems... the differences should be on a pointer size (depending on the system) and on the length of the empty buffer...

    I'm very sorry for all English people : I think they can't understand my franglich...

    Thanks for your participation !
    (I hope it will be working !!!)
    Christophe



    Post edited on 2011/05/12 :

    There is an issue when scanning memory : it is not possible to know if a pointer is valid before to use it.
    So, I modified BSFN and UBE to avoid "BSFN has caused a memory violation"...
    I also translate BSFN to Unicode
    Now, you have to run the batch a first time with Processing Option = 0, to have a PDF with memory dump (no memory scan at this time)
    With the dump, locate one or pointers
    Then, run the batch with PO = offset of pointer &gt;&gt;&gt; If PDF prints "Pointer to Data Structure "pUBEVar" possibly found at "lpReportSection" offset :", you found it !

    Locating a pointer on the dump :
    - on Windows and Unix, pointers are "reversed" &gt;&gt;&gt; pointer 0x3813F22F displays as "2F F2 13 38"
    - on AS-400... I don't know...

    Known at this time
    - Xe-Win, Xe-Unix, E9-Win : offset = 44 (tested)
    - Win (all jde versions) : offset = 44 (not tested, but possible...)
    - Unix (all jde versions) : offset = 44 (not tested, but possible...)
    - AS/400 ????
    - Windows 64bits ????
    ... to be continued...

    If you have a value for the offset for an unknown system, please add a message to this post and attach your PDF
    Attached Files Attached Files
    Xe UPDATE 7 SP21, AIX 5.2, Oracle 9.2

  8. #8
    New Member
    Join Date
    Apr 2008
    Location
    India
    Posts
    25

    Re: Retrieve Current Server JobNumber on ALL system ???

    Hi

    Iam not able to access the attacment // Woull you please attach the file again.

    Thanks
    Prasant
    OneWorld XE/8.11SP1/9.0
    Oracle 9i

  9. #9
    New Member
    Join Date
    Feb 2008
    Posts
    41

    Re: Retrieve Current Server JobNumber on ALL system ???

    For E8.11.1/SP 8.98/Unix the offset is at 44. Thanks Christophe for your help!!

  10. #10
    New Member
    Join Date
    Aug 2014
    Location
    Ecuador
    Posts
    4
    Gracias, funciona también AIX (Offset ia at 44).

    Saludos,
    David León
    Developer

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Business function to calculate the current period and current fiscal year
    By praveen1219 in forum JD Edwards® EnterpriseOne Developers
    Replies: 5
    Last Post: 03-14-2011, 07:31 AM
  2. Retrieve Current Server JobNumber on AS/400
    By chviaud in forum JD Edwards® EnterpriseOne Developers
    Replies: 1
    Last Post: 04-21-2008, 04:12 AM
  3. Custom BSFN : Retrieve Current Server Job Number using on E812
    By Gov in forum JD Edwards® EnterpriseOne Developers
    Replies: 4
    Last Post: 08-23-2007, 09:52 PM
  4. Any Business Function to retrieve Full Path of the current Environment
    By PlanetOneWorld in forum JD Edwards® EnterpriseOne Developers
    Replies: 5
    Last Post: 01-02-2005, 08:37 PM
  5. How to retrieve the UBE jobnumber on AS400
    By Axel in forum JD Edwards® EnterpriseOne Developers
    Replies: 1
    Last Post: 03-05-2001, 06:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
The legal restrictions and terms of use applicable to this site are available here.
Use of this site signifies your agreement to the terms of use.
JDELIST is NOT affiliated with JD Edwards® & Company, Oracle or Peoplesoft. Contents of this site are neither endorsed nor approved by JD Edwards® & Company and, or Oracle.