Question

I have this file http://pastebin.com/pH4Pk0sf without extension, and it may be COBOL, because the computer it's hosted uses BASIC, COBOL and something called "KEY BASIC"... I don't understand this code... I do with some lines but not all...

I want to convert this to C# but I have no idea about how, if someone can tell me which language is it, maybe I can dig more.

The program reads this other file http://pastebin.com/rdbdappQ and creates an output for printer... I need to know how the hell it works in order to make a Windows program (via C#) to do the same...

Thank you.

UPDATE

Thank for your help, I'm trying to recreate the code, I see things like this OPEN '3/1/TABPRESU' FOR RANDOM IO ELSE DISPLAY 'NO ABRE TABPRESU';STOP I don't know what is "3/1/TABPRESU" of course it is a file, I have "TABPRESU" but what is "3/1" ? is not a FileSystem, because it does not exists, or maybe it is some kind of DataBase ?

The program we're using is SovereignX, under UNIX, it has an option UNIXCOPY which allows user to copy afile from SovereignX to UNIX Filesystem, I haven't found any info about SovereignX...

It would be extremly helpful to find a way to see the source code of everything and recreate it, we do the INPUT under a command called BE (Batch Entry). I'm trying to download whole OS to an USB Drive via FTP (I don't know why the machine wont boot UBUNTU LIVE USB, the motherboard allows you to boot it, but nothng happens so the only option is download via FTP and try to run it under some virtual machine...

http://en.wikipedia.org/wiki/Northgate_Information_Solutions

Northgate Purchased Microdata (creator of SovereignX), then Mcdonell Douglas purchased northgate... This research is killing me... Seems that everything is under some kind of databse, written in DATA/BASIC and PROC

http://timmcnulty.iofm.net/realityx.htm

UPDATE 2 IT IS KEYBASIC LANGUAGE... But it is a bit messy if I open the files with NP++, I need to export from SovereignX then it can be read... But doing that with ~100 files is extreme... Someone knows a KeyBasic IDE? mhh thanks

UPDATE 3 The .DAT and .IDX files this program has, are password protected, from console it doesnt ask me for password but it does if I use DBISAM Viewer, and nobody knows the password... Damn

Was it helpful?

Solution

Definitely a BASIC dialect. Fairly old code, so there's nothing too obscure. An IF ... THEN is an IF ... THEN.

The code between the lines numbered 5 and 90 (lines 10 through 38 in your pastebin) is your main processing loop. The GOSUBs at lines 5000 and 9000 are subroutines called from the main loop.

A couple of the more arcane features that I see here, irrespective of the dialect:

  • OCONV is a formatting function; think of it like sprintf()
  • the PRINT statements appear to be inserting a space before each nonblank line; old-style line printers often interpreted the first character of a print line as a control character to advance to a new page, e.g.; a space means "just print the line"

Update

Something I missed on the first reading: the bracket syntax is performing a substring operation. So, for instance, the code at line 12 of your pastebin,

IF R[26,2]='20' THEN GOSUB 9000;GOTO 5

is comparing characters 26 and 27 of the buffer (associated with the READ at line 5) to the string '20'. In the next line, R[26,2]#30, the # is a not-equal-to operator.

Update

I'm with you, not all the formatting strings are explained in the doc. But I suspect that Z, 9, and , work like they do in COBOL.

  • Z: suppress leading zeroes: print space if the corresponding digit and all digits to the left are zero, the digit otherwise
  • ,: print a comma if there is a nonblank/nonzero digit to the left, space otherwise
  • 9: print the corresponding digit, even if it's zero

So with a format string of MDZZ,ZZ9:

0     prints as      0
12    prints as     12
123   prints as    123
1234  prints as  1,234
12345 prints as 12,345

Update

The syntax of the OPEN statement in your pastebin does not exactly match the documentation for Caché MultiValue Basic nor for UniBasic. However, I can surmise that part of the string '1/1/FSNC0128S' represents channel number 1, and it's this same channel number that appears in

5    READ R FROM 1 ELSE GOTO 90

Think of a channel number like a filehandle in Perl or a C file descriptor.

I would work under the assumption that the other 1 in the string is some sort of access modifier (although the FOR RANDOM IO would seem to contradict), and just focus on locating the file FSNC0128S.

OTHER TIPS

I can tell you what it originally was because I implemented KEYBASIC back in around 1976/77. I worked at CMC on the Sovereign system and implemented their data entry system. The company already had a fairly standard Basic interpreter and run-time system which ran on a Sovereign system. I modified this firstly to become time-shared because multiple data-entry users used one Sovereign processor and secondly to add some extra data-entry oriented functions, which were all prefixed by "K". The modified language was then called "KEYBASIC".

Cache MultiValue Basic is the best fit that I can find.

It's definitely some dialect of BASIC. A number of years ago, Data General had a basic version that was prominent at the time for serious multi-user business applications. Wikipedia has an article that mentions this dialect and some similar competitors.

http://en.wikipedia.org/wiki/Data_General_Business_Basic

If the code is very old, have you checked the possibility that it's CBASIC? CBASIC was a popular way to develop business applications on early microcomputers.

http://en.wikipedia.org/wiki/CBASIC

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top