EGL Development User Group

EGL Development User Group

EGL Development User Group

The EGL Development User Group is dedicated to sharing news, knowledge, and insights regarding the EGL language and Business Developer product. Consisting of IBMers, HCL, and users, this community collaborates to advance the EGL ecosystem.

 View Only
Expand all | Collapse all

Is datatype decimal valid when generating to java ?

  • 1.  Is datatype decimal valid when generating to java ?

    Posted Thu May 07, 2015 08:14 AM

    We build EGL batch programs - generated as Cobol batch on z/OS. That works fine - no problems.

    We now want to generate the same EGL batch program as java, to be run on linux. In general that works fine too.

    But - we have some sequential file structures with dataitems type decimal(13,2), where the files are written by one batch program and read by the next.

    My question is:

     - are there any problems using datatype decimal(13,2) when generating to java ? Guess this datatype could give problems as the content is a mainframe format "packed decimal" with the sign in the last half fbyte.

    Have anyone tried this datatype with luck  using java ?

    TIA

    Morten Hansen, IBM Denmark

     

     

    mohaIBMDK


  • 2.  Re: Is datatype decimal valid when generating to java ?

    Posted Thu May 07, 2015 10:00 AM

    Morten,

    I just tried it quickly and it seemed to work fine.   It is still written out to the file in packed decimal format but the read understands it as well.

    Here are the two sample programs I wrote.

    Add program:

    package testpkg;

    // basic program
    //
    program writfil type BasicProgram {
      includeReferencedFunctions = yes, allowUnqualifiedItemReferences = yes,
      throwNrfEofExceptions = yes, handleHardIOErrors = no, V60ExceptionCompatibility = yes,
      I4GLItemsNullable = no, textLiteralDefaultIsString = no, localSQLScope = yes
      }
        
        serfile serfile;
        function main()
            serfile.resourceAssociation = "C:/temp/serfile.txt";
            serfile.mychar = "AAA";
            serfile.mydec = 99.88;
            try
                add serfile;
            onException
                writestdout("error = " + sysvar.errorCode);
            end
                
        end
        
    end

    record serfile type serialRecord
       {fileName = "serfile"}
       10 mychar char(3);
       10 mydec decimal(13,2);
      end

    Read Program

    package testpkg;

    // basic program
    //
    program readfil type BasicProgram {
      includeReferencedFunctions = yes, allowUnqualifiedItemReferences = yes,
      throwNrfEofExceptions = yes, handleHardIOErrors = no, V60ExceptionCompatibility = yes,
      I4GLItemsNullable = no, textLiteralDefaultIsString = no, localSQLScope = yes
      }
        
        serfile serfile;
        function main()
            serfile.resourceAssociation = "C:/temp/serfile.txt";

            try
                get next serfile;
                writestdout("mychar = " + serfile.mychar);
                writestdout("mydec = " + serfile.mydec);
            onException
                writestdout("error = " + sysvar.errorCode);
            end
                
        end
        
    end

    markevans


  • 3.  Re: Is datatype decimal valid when generating to java ?

    Posted Thu May 07, 2015 10:12 AM

    Hi Moha,

    The last half byte can be:
     
    Positive: C
    Negative: D
    Absolute positive: F (unsigned)

    The definition of the DECIMAL type is always with signal (D or C) as well as in cobol is a PIC S9 (13) V99 COMP-3 and as PACK in VAGen

    if no sign is defined as PIC 9(13)V99 in COBOL then the last half byte is always F. There is a EGL primitive type PACF coming from the VAGen.

    to say whether the use of DECIMAL type is valid or not, it will depend on how the field was defined in the record in the recording.

    Hsieh

     

    Hsieh