Need to convert cobol program to something Unix

From: Adams Kevin J (kevin.adams_at_PHS.COM)
Date: 08/29/05

  • Next message: Jeff Barratt-McCartney: "Re: filemon question"
    Date:         Sun, 28 Aug 2005 21:17:24 -0700
    To: aix-l@Princeton.EDU
    
    

    Hi,

    Anyone like to take a crack at converting a small Cobol compression routine
    into something Unix, i.e., awk, ksh, perl?

    The program compresses a 6 byte field into a 4 byte field.

    Here it is:

    Identification division.
    Program-id. REVERSE.

    Data division.
    Working-storage section.

    01 ASCII-CHAR.
      05 ASCII-VAL pic 9(4) comp value zero.
    01 OFFSET-VAL pic 9(2).
    01 OUT_VAL pic X(4) value "T998".
    01 tmp_val pic x(6).
    01 IN_VAL pic 9(6).

    Procedure division.
    Main.
        if out_val(1:1) is numeric then
           move out_val to in_val
         else
            move OUT_VAL(2:3) to tmp_val(4:3)
            move "0" to tmp_val(1:1)
            move out_val(1:1) to ASCII-CHAR(1:1)
            Subtract 55 from ASCII-VAL
            move ascii-val to offset-val
            move offset-val to tmp_val(2:2)
            move tmp_val to in_val
         end-if.
        display 'Outval ', out_val.
        display 'Final Inval ', in_val.
        Exit Program.
    End Program REVERSE.

    Thanks,

    Kevin Adams
     

    This electronic message transmission, including any attachments, contains information from PacifiCare Health Systems Inc. which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited.
    If you have received this electronic transmission in error, please notify the sender immediately by a "reply to sender only" message and destroy all electronic and hard copies of the communication, including attachments.


  • Next message: Jeff Barratt-McCartney: "Re: filemon question"