COBOL .txt file...

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

COBOL .txt file...

Post by sal21 »

I need to understand in this two strings the last character "}" and "{":

00000000000500000}
00000000000281000{

Googoling..., i have undertand is a correspondence of + and - in COBOL, but i need to be sure for tath.
Tks.

User avatar
HansV
Administrator
Posts: 78235
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: COBOL .txt file...

Post by HansV »

As far as I can tell, 00000000000500000} means -000000000005000000, and 00000000000281000{ means +000000000002810000

See EBCDIC to ASCII Conversion of Signed Fields
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4334
Joined: 26 Apr 2010, 17:36

Re: COBOL .txt file...

Post by sal21 »

HansV wrote:As far as I can tell, 00000000000500000} means -000000000005000000, and 00000000000281000{ means +000000000002810000

See EBCDIC to ASCII Conversion of Signed Fields

OK.. tks.
and if i want to process this string in vb6 how to change dinamiclly the signs and transform the string?

with a select case on the last charcater, or with replace, or...?

User avatar
HansV
Administrator
Posts: 78235
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: COBOL .txt file...

Post by HansV »

I think you'd need to do something like this:

Code: Select all

    MyVar = ...
    Select Case Right(MyVar, 1)
        Case "{"
            MyVar = "+" & Left(MyVar, Len(MyVar) - 1) & "0"
        Case "}"
            MyVar = "-" & Left(MyVar, Len(MyVar) - 1) & "0"
    End Select
but I'm not a COBOL expert...
Best wishes,
Hans