Results 1 to 4 of 4

Thread: B98ORCH output : parsing the output value in vase of exception

  1. #1
    Member
    Join Date
    Nov 2006
    Location
    Clichy, France
    Posts
    70

    B98ORCH output : parsing the output value in vase of exception

    Hi I have the requirement to get the output from the orchestration response in case of failure. We would like to create a table dedicated to end users, so they could now why their request failed.
    So if my output is like that :

    { "status":"ERROR", "message" : "SR_FR_GenerationCollecteCreationFicheLogCde1) Code-Control: 019U-13_51, Title: Error: Version Effective - From Date incorrecte, Description: - Mois incorrect (il doit être situé entre 1 et 12). - Jour incorrect (il doit être situé entre 1 et 31, et compatible avec le mois). - Année incorrecte (elle doit être située entre 00 et 99). - Date non entrée. SOLUTION - Entrez une valeur Effective - From Date correcte.", "exception" : "java.lang.Exception", "timeStamp" : "2019-01-25T09:27:41.840+0100", "userDefinedErrorText" : "stefan texte supplémentaire suite err création fiche log!", "type" : "application","exceptionProcessResponse":{"Service Request1":{"fs_P90CB020_W90CB020D":{"title":"Reche rche d'opportunités","data":{"gridData":{"id":1,"fullG ridId":"1","columns":{"z_DSCRP1_19":"Description", "z_AN8_17":"Client Facturation","z_ALPH_18":"Nom client Facturation","z_ALPH_81":"Nom contact Facturation","z_CUSAN8_89":"Client Expédition","z_ALPH_90":"Nom client Expédition","z_ALPH_91":"Nom contact Expédition","z_PBLTY_21":"%","z_CLDATE_22":"Date Clôture","z_PTAMT_23":"Montant Potentiel","z_CRCD_24":"Code Monétaire","z_OPTYCD_25":"Code type Opportunité","z_QUFSCR_26":"Note Qualification","z_QUFGL_27":"Objectif Qualification","z_OPPID_28":"Nº Opp.","z_PBLTYQ_44":"Probabilité Interr."},"rowset":[{"z_OPTYCD_25":"DIR","z_PBLTYQ_44":100,"z_ALPH_18" :"Suepermarché 17","z_CRCD_24":"EUR","z_QUFSCR_26":0,"z_ALPH_81": null,"z_AN8_17":2083025,"z_CUSAN8_89":2083025,"z_C LDATE_22":"2018-11-23T01:00:00.000+0100","z_ALPH_91":null,"z_ALPH_90" :"Suepermarché 17","z_QUFGL_27":0,"z_DSCRP1_19":"stef67","z_PBLTY _21":100,"z_OPPID_28":446,"z_PTAMT_23":0}],"summary":{"records":1,"moreRecords":false}}},"er rors":[],"warnings":[]},"stackId":0,"stateId":0,"rid":"","currentApp":"P 90CB020_W90CB020D_FRSAR0001","timeStamp":"2019-01-25:09.27.56","sysErrors":[]}}}

    I'd like to get back the following subtext :
    • "status":"ERROR" => I'd like to know if the statut is ERROR or other
    • "message" : "SR_FR_GenerationCollecteCreationFicheLogCde1) Code-Control: 019U-13_51, Title: Error: Version Effective - From Date incorrecte, Description: - Mois incorrect (il doit ĂŞtre situĂ© entre 1 et 12). - Jour incorrect (il doit ĂŞtre situĂ© entre 1 et 31, et compatible avec le mois). - AnnĂ©e incorrecte (elle doit ĂŞtre situĂ©e entre 00 et 99). - Date non entrĂ©e. SOLUTION - Entrez une valeur Effective - From Date correcte." => I'd like to have the entire message
    • "userDefinedErrorText" : "stefan texte supplĂ©mentaire suite err crĂ©ation fiche log!" => i'd like to have the entire message.


    So how do I strip this information from the entire strin, I didn't found any cleaver C function in JDE to do that.
    If you could help me, It will be great.

    I'm running JDE 9.2, tools 9.2.3.1 under an AS400 V7R3.
    Regards
    Yann Buffetaud
    JDE analyst
    SARIA

  2. #2
    Member
    Join Date
    Dec 2000
    Location
    Australia
    Posts
    582
    Hi Yann,

    I haven't tried this myself but I suggest you look for an ANSI C JSON parser. There are a few open source available that seem quite small and simple. I would think a parser could be integrated into a custom BSFN that could take the JSON response string as input and return the status, message and userDefinedErrorText back to you.

    Another way to do it would be to compile the JSON parser into an external library. There are ways to parse JSON in RPG and you can make a wrapper to make an RPG program callable via JDE C. Personally I wouldn't complicate it and just stick to ANSI C inside of JDE.

    My last wild idea would be to just leverage DB2 for i's JSON support. I have been away from the AS/400 for a few years so I haven't had a chance to use this but I have used its Oracle equivalent JSON_TABLE. You could just insert the message as is to a table. You could then create a view over that table that parses out the JSON as columns which could then further be exposed to JDE using the virtual table technique we have discussed many times.

    See this article on DB2 i JSON. https://www.mcpressonline.com/analyt...with-db2-for-i

    I would be interested to hear how you go with this.
    Justin Miller

  3. #3
    Member
    Join Date
    Nov 2006
    Location
    Clichy, France
    Posts
    70
    Hi I juste discovered that B98ORCH could already do this if you type as output parameter "userDefinedErrorText", tou get it in on of the 20 available output.
    The only limitation is that those fields are only 200 characters long.
    But it will just meet our requirement
    Yann Buffetaud
    JDE analyst
    SARIA

  4. #4
    Member
    Join Date
    Jun 2001
    Location
    Colorful Colorado
    Posts
    469
    When there is an AIS error, the C BSFN B98ORCH returns the error text automatically in the szOutputString_REPTEXT field, which is 32Kb.

    [Edit: nevermind, I just remembered that this is still in JSON, so you'd probably still have to parse it]
    --john

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.