Welcome Guest.   Make a donation to an author on the site April 24, 2014, 06:23:02 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Your Support Funds this Site: View the Supporter Yearbook.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: DONE: How do I convert (wtf is this? Cobol?) to numbers? Examples included  (Read 8941 times)
dementedmuppet
Supporting Member
**
Posts: 25



see users location on a map View Profile Give some DonationCredits to this forum member
« on: February 12, 2008, 09:09:09 AM »

The data is received in a funky format because negative values are not allowed.  The numbers are converted as:

On a positive number:                                On a negative number:

{ = 0                                                         } = 0
A = 1                                                         J = 1
B = 2                                                         K = 2
C = 3                                                         L = 3 
D = 4                                                        M = 4
E = 5                                                         N = 5
F = 6                                                         O = 6
G = 7                                                         P = 7
H = 8                                                         Q = 8
I = 9                                                          R = 9

Examples:

0000568G = $56.87
0001651L = -$165.13

I need to convert the wacky 0000568G types to currency types.  Anyone got code for this? 

I have sample code that does the opposite but reversing code I barely understand is a waste of time if someone already has code to do what I need:

 


Hoping for help
Sincerely
Muppet


edit by jgpaiva: added spoiler/code tag
« Last Edit: February 15, 2008, 03:10:58 AM by jgpaiva » Logged

Impossible is nothing
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: February 12, 2008, 09:26:07 AM »

That sounds like coding snack material.

Could you explain it a bit better?

Where are those numbers? In a file? One per line?
Logged

dementedmuppet
Supporting Member
**
Posts: 25



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #2 on: February 12, 2008, 09:35:38 AM »

The numbers start in a flat file (.txt) for EDI.  They are fixed width (not comma delimited)

I use a macro to format the data into columns for a more meaningful Excel spreadsheet with column headings.

Just knowing wtf type of system this is would help me with the conversion to currency.  Obviously it isn't hex tongue 

While the sample code works to convert from currency to the (wtf) string, it isn't helful converting from (wtf) string to currency. 

ASCII??

Any hints?
« Last Edit: February 12, 2008, 09:37:59 AM by dementedmuppet » Logged

Impossible is nothing
dementedmuppet
Supporting Member
**
Posts: 25



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #3 on: February 12, 2008, 10:21:09 AM »

It seems to be a COBOL standard but I haven't determined which standard
(How many standards did they need?? Ugh!)

0000568G = $56.87
0001651L = -$165.13

What is the likelihood that any of these will help?
http://download.oracle.co...rmat/DataFormatUtils.html
« Last Edit: February 12, 2008, 10:27:35 AM by dementedmuppet » Logged

Impossible is nothing
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #4 on: February 12, 2008, 10:44:18 AM »

Actually,the system makes sense. The idea is to have a fixed maximum length for the number. The fact it has 2 types of characters allows it to have the same maximum size equal for both positive and negative numbers.
Logged

dementedmuppet
Supporting Member
**
Posts: 25



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #5 on: February 12, 2008, 11:27:00 AM »

Yes, it is logical and convenient for transmissions but I need to figure out precisely what the standard is so I can write the code to convert it back to currency.

COBOL 'making sense' is why it doesn't die.  From accounting/finance perspective, COBOL is beautiful.  It is the backbone of financial systems since it is the best tool for the job.  Just today, while I'm frustrated, "tool" takes on a different meaning.
Logged

Impossible is nothing
tinjaw
Supporting Member
**
Posts: 1,926



I'm so glad breakbeat techno isn't an illegal drug

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #6 on: February 12, 2008, 11:35:12 AM »

I understand in general want you want to do, i.e. convert from "COBOL" to currency.

What do you want to do in practical terms? Are you looking to input a text file and output a text file? If you already have the data in Excel, write a VBA macro to do the conversion.
Logged

 
dementedmuppet
Supporting Member
**
Posts: 25



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #7 on: February 12, 2008, 01:00:35 PM »

VBA maro would be ideal

Either to convert the values while keeping them in the Excel cells they currently occupy, or create a new tab that has the converted values.

The sample code is VBA used to create "COBOL" values.  Theoretically, I could edit & rearrange it to reverse the process.  My failure to understand the code makes that difficult.

Any reference sites you've found helpful?

« Last Edit: February 12, 2008, 01:44:32 PM by dementedmuppet » Logged

Impossible is nothing
tinjaw
Supporting Member
**
Posts: 1,926



I'm so glad breakbeat techno isn't an illegal drug

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #8 on: February 12, 2008, 01:48:52 PM »

I have never actually done VBA in Excel before, but try this...

[copy or print]
Function format_currency2(ByVal money As String) As String
    'convert from internal format to currency
   
Select Case Right(money, 1)
        'positive numbers
       
        Case "{"
            money = Left(money, Len(money) - 1) & "0"
        Case "A"
            money = Left(money, Len(money) - 1) & "1"
        Case "B"
            money = Left(money, Len(money) - 1) & "2"
        Case "C"
            money = Left(money, Len(money) - 1) & "3"
        Case "D"
            money = Left(money, Len(money) - 1) & "4"
        Case "E"
            money = Left(money, Len(money) - 1) & "5"
        Case "F"
            money = Left(money, Len(money) - 1) & "6"
        Case "G"
            money = Left(money, Len(money) - 1) & "7"
        Case "H"
            money = Left(money, Len(money) - 1) & "8"
        Case "I"
            money = Left(money, Len(money) - 1) & "9"
       
        'negative numbers
           
        Case "}"
            money = "-" + Left(money, Len(money) - 1) & "0"
        Case "J"
            money = "-" + Left(money, Len(money) - 1) & "1"
        Case "K"
            money = "-" + Left(money, Len(money) - 1) & "2"
        Case "L"
            money = "-" + Left(money, Len(money) - 1) & "3"
        Case "M"
            money = "-" + Left(money, Len(money) - 1) & "4"
        Case "N"
            money = "-" + Left(money, Len(money) - 1) & "5"
        Case "O"
            money = "-" + Left(money, Len(money) - 1) & "6"
        Case "P"
            money = "-" + Left(money, Len(money) - 1) & "7"
        Case "Q"
            money = "-" + Left(money, Len(money) - 1) & "8"
        Case "R"
            money = "-" + Left(money, Len(money) - 1) & "9"
      End Select
     
      format_currency2 = money * 0.01
       
End Function
Logged

 
dementedmuppet
Supporting Member
**
Posts: 25



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #9 on: February 12, 2008, 03:12:34 PM »

It works.  If my child did not already have a cool name, he woud be "chaim"
Logged

Impossible is nothing
dementedmuppet
Supporting Member
**
Posts: 25



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #10 on: February 14, 2008, 03:02:00 PM »

Tinjaw's code works well.  I was supposed to have the reports done two days ago.  My macros were buggy.  Scoured VB help & killed a few trees printing some VB help (hopefully, this addiction to paper will pass).

Yesterday, Excel was getting hung up on converting cells.  Driving home, I realized the problem was likely that I left "#VALUE!" errors in the range I told Excel to convert to numbers.  Brilliant  Thmbsup

After six hours of trying to fix the macros, I clicked the little "!" help icon that was beside the data that needed modified.  One option was "help with this error."  The solution was "multiply by 1".  That WOULD explain why there are no VB methods to fix the issue.

See?  Hopeless  Roll Eyes


The macro comments included my name (now removed).  Why don't I add my social security number, passwords, etc...   Genius, I tell ya.  GENIUS!
« Last Edit: February 14, 2008, 03:22:05 PM by dementedmuppet » Logged

Impossible is nothing
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #11 on: February 14, 2008, 05:03:54 PM »

Sorry, but i didn't understand from your post: Did you get the problem solved?  embarassed
Logged

dementedmuppet
Supporting Member
**
Posts: 25



see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #12 on: February 14, 2008, 09:25:42 PM »

Nice of you to ask   smiley

I got the reports formatted and sent.

My code needs some work so future reports aren't so much hassle. 

Tinjaw's code really helped in getting me on the right track.  Just a few quirks to sort out to fully automate it.

I also have to take out the wacky bits like scrolling & resizing the window.  My boss & coworkers get all impressed by the errors because it makes it LOOK like the code is doing something.  But eventually I have to turn it over to I.T. for them to add to their processing schedule. They won't be impressed by wacko irrelevant lines.

Concise answer:  problem solved.  Thanks!!
Logged

Impossible is nothing
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #13 on: February 15, 2008, 03:07:34 AM »

 Grin Grin Grin

Ok then, great! smiley
Logged

abhaytanu
Participant
*
Posts: 2

View Profile Give some DonationCredits to this forum member
« Reply #14 on: December 03, 2008, 04:45:04 AM »

Hi
   may i know which jar is require for com.bankframe.ei.txnhandler.dataformat.DataFormatUtils. It is urgent. In my application i want to use DataFormatUtils. but i'm not getting that which jar must we need for the same.Waiting for reply
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.055s | Server load: 0.11 ]