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!

Converting Micro-Focus To RM/Cobol-85 2

Status
Not open for further replies.

ChrisPhillips

Programmer
Aug 1, 2000
11
NL
I'm currently converting some Micro-Focus COBOL programs to RM/Cobol and have encountered a problem.

Does anybody know what a Micro-Focus COMP-X field should be in RM/Cobol as I'm currently getting the following error

Data description entry has wrong format.
 
Hi,

I don't know so much about MicroFocus COBOL, but on deja vu there was some explanation about the comp-x. It said it is a binary pic s9(4). So the size is two bytes.

Let us know if this helps!
 
In MF comp-x is unsigned binary starting with the high-order bytes.
For example:
pic x(4) comp-x value 1 would be hex: 00 00 00 01
pic x(4) comp-x value 255 would be hex: 00 00 00 FF

so:
pic x(1) comp-x is 1 byte maximum value 255.
pic x(2) comp-x is 2 bytes maximum value 65535.
pic x(4) comp-x is 4 bytes maximum value 4294967295.

On a PC the storage of binary data is stored with low-order bytes first, so the opposite of MF comp-x.

 
On a pc, a binairy field is almost the same as you describe here. A comp-5 field has the higher order byte first.

Isn't it strange to say about a X field that it is computational?
 
COMP and COMP-whatever are up to the individual implementor as to what data types they mean. They are usually assigned to whichever of the hardware computational facilities the implementor wants the programmer to have access to. Unfortunate that there's no standard, but that's why they added BINARY and PACKED-DECIMAL to the list. They mean the same thing everywhere.

It's not just strange to call an X field computational; it's a violation of the rules and you get a syntax error. Betty Scherber
Brainbench MVP for COBOL II
 
The IBM mainframe definitions are supported by the more important compilers.

COMP-3 is also PACKED-DECIMAL
COMP-4 is also COMP is also BINAIRY

In the PC environment COMP-5 is the INTEL native format.

On the mainframe with the new COBOL 390 2.2 compiler it is also a native format for the mainframe so it is IBM native format. It is not harmed by the compiler option TRUNC(STD).
 
Hi, you can try this url to the microfocus for unix
documentation, is there many issues for migrating from
rm/cobol, so by opposite this may help.

HTH
Pablo
 
Thanks people, I think that I've got this one sussed as I have to user the configuration option COMPILER-OPTIONS BINARY-ALLOCATION=MF-RM and it then stores the COMP fields just like MF.
 
Obviously Betty never worked with MF-cobol.
Pic x(2) comp-x copiles very well.
I would appreciate she first checkes things before acusing me of puting code on this forum that will give compile errors.


 
All,

in my humble opinion with a 6+ year experience in programming COBOL in a mainframe environment, i personally think BettyScherber has a host of very valuable tips to offer, not only in the environment she is used to, but COBOL-wise generally.
Discarding anyones reaction which makes perfect sense in respect to the current COBOL standards, only emphasises the lack of some compiler manufacturers to ignore the internationally acknoledged standards.
In retrospect to many other so-called languages, COBOL is one of very few that is actually standardised, and any diversion from the standard may be considered undesired.
Let's not put eachother's input down, but learn from each and every one of us !
 
Crux-
Sorry about that. I wasn't trying to put you down. It just seemed such an obvious contradiction of the ANSI standard that it couldn't be right. I actually figured you had probably mis-typed it and an explicit warning was in order lest someone try to use it. Since it wouldn't work on the IBM, HP, DEC, Wang, Data General, or any of the PC platforms that I have used in my 29+ years in COBOL, I thought it best to say don't use PIC X's for computational items. I know that they don't work in RM-COBOL which is what Chris was trying to translate to, as I have an RM-COBOL manual right here next to me.
Anyway, sorry you took offense, none was intended.

Betty Scherber
Brainbench MVP for COBOL II
 
Thanks Betty,
In fact you can use both in MF-Cobol:
pic 9(02) comp-x.
pic x(02) comp-x.
comp-x is used to store unsigned binary data.
If you use 'pic x' the physical size of the item is exactly the size you define, and if you use 'pic 9' the size is calculated:
pic x(02) comp-x is 2 bytes.
pic 9(02) comp-x is 1 byte.
1 byte can store upto 255, which is large enough for 9(02)
which implies 2 digits ( upto 99 )
funny is:
pic 9(02) comp-x value 255 is accepted.
pic 9(02) comp-x value 256 gives a compile-error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top