Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input Comp-3 fields not compatible with Unisys

Status
Not open for further replies.

Martorell

Programmer
May 28, 2003
1
US
I have a flat file (with some fields comp-3) that I need to read in Unisys (that doesnot support comp-3). Can anyone give me any ideas? I'm using XGEN (a COBOL solution might be useful too). Can I read it (comp-3) in SQL Server?

Warm Regards from Miami
SunFlower.gif
 
I assume this is a conversion project from another system that created this file and supported the COMP-3 fields? Or is this a cross-platform solution where the file is being sent from another system to be processed there and then to be sent back with processing results?

I don't know about XGEN and what it can do, but is there something possible other than COBOL if you do have to do a conversion?
 
See if you can create an extra flat file without COMP-3. Then using it as your input.
 
Agree with hhtran. The
Code:
PIC S999 sign trailing separate character
is very well suited for inter-platform communication. ASCII EBCDIC? Positive or negative values? No problemo: both humans and cobol can read it very clearly!
 
Try this.
Code:
**** 01  ANNUAL-INCOME           PIC S9(7)V99 COMP-3.
     01  ANNUAL-INCOME-X.
         10  AS-BYTE             PIC X(01) OCCURS 5 TIMES.

     01  ANNUAL-INCOME           PIC S9(7)V99 COMP.
     01  ANNUAL-INCOME-I REDEFINES
                   ANNUAL-INCOME PIC S9(9)    COMP.

     01  WORK-1                  PIC S9(4)    COMP.
     01  REDEFINES WORK-1.
         05  WORK-1A             PIC X(01).
         05  WORK-1B             PIC X(01).

     01  WORK-2                  PIC S9(4)    COMP.
     01  REDEFINES WORK-2.
         05  WORK-2A             PIC X(01).
         05  WORK-2B             PIC X(01).

     01  IDX                     PIC S9(04)   COMP.

     CONVERT-TO-BINARY.
         MOVE ZERO             TO WORK-1
         MOVE ZERO             TO ANNUAL-INCOME-I
         PERFORM VARYING IDX FROM 1 BY 1 UNTIL IDX > 5
             MOVE AS-BYTE(IDX) TO WORK-1B
             MOVE WORK-1       TO WORK-2
             DIVIDE 16       INTO WORK-1
             MULTIPLY 9        BY ANNUAL-INCOME-I
             ADD WORK-1        TO ANNUAL-INCOME-I
             MULTILPLY 16      BY WORK-1
             SUBTRACT WORK-1 FROM WORK-2
             MULTIPLY 9        BY ANNUAL-INCOME-I
             ADD WORK-2        TO ANNUAL-INCOME-I
         END-PERFORM
         MOVE AS-BYTE(5)       TO WORK-1B
         MOVE WORK-1           TO WORK-2
         DIVIDE 16           INTO WORK-1
         MULTIPLY 9            BY ANNUAL-INCOME-I
         ADD WORK-1            TO ANNUAL-INCOME-I
         MULTILPLY 16          BY WORK-1
         SUBTRACT WORK-1     FROM WORK-2
         IF WORK-2 = 11 OR 13
             MULTIPLY -1       BY ANNUAL-INCOME-I
         END-IF
         .
 
Error in above code. Should be
Code:
PERFORM VARYING IDX FROM 1 BY 1 UNTIL IDX > [COLOR=red]4[/color]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top