Absent Member.
Absent Member.

[archive] Translating C constants

[Migrated content. Thread originally posted on 05 December 2003]

I'm working on a payroll project that uses a DLL written in C that makes use of constants that are defined in C .H file. I'm unsure of the proper way to convert these constants to acucobl level 78's. In the past, I've converted hex values like this to their numeric value and then set the level 78 value to this. I was wondering if there is another way though. Like perhaps using the X'nnnnnnnn' syntax? Any advice would be appreciated. Here's the values I'm working with. I've also attached the full .H file in case there is any further advice about converting it's contents. Thanks all!

#define SLT_FIND_FROM_START 0x00000000
#define SLT_FIND_ANYWHERE 0x00000001
#define SLT_FIND_NO_CASE_SENSITIVE 0x00000002

#define SLT_VALUE_PERC 0x00000001
#define SLT_VALUE_FLAT 0x00000002
#define SLT_VALUE_TABLE 0x00000004
#define SLT_VALUE_COMPLEX 0x00000008
#define SLT_VALUE_YEAR 0x00000010
#define SLT_VALUE_MONTH 0x00000020
#define SLT_SAME_RATE_R_NR 0x00000040
#define SLT_MISC_HOLDS_NR_VALUE 0x00000080

#define SLT_LIMIT 0x00000100
#define SLT_LIMIT_PERC 0x00000200
#define SLT_LIMIT_FLAT 0x00000400
#define SLT_LIMIT_YEAR 0x00001000
#define SLT_LIMIT_WEEK 0x00002000

#define SLT_MINIMUM 0x00010000
#define SLT_MINIMUM_WAGE 0x00020000
#define SLT_MINIMUM_WAGE_MONTH 0x00040000

#define SLT_RESIDENT 0x00100000
#define SLT_NON_RESIDENT 0x00200000
#define SLT_ATTR_RESIDENT 0x00400000
#define SLT_ATTR_NON_RESIDENT 0x00800000

#define SLT_BASE 0x01000000
1 Reply
Absent Member.
Absent Member.

RE: [archive] Translating C constants

Hi DanM,
If you want use these constant for calling a DLL function I would suggest you to use a 77 level instead of level 78.
This because in some circumstances I notice the compiler generates a temporary variable that is not the same size of the one expected by the C function.
For instance :

#define SLT_FIND_FROM_START 0x00000000

this looks to be a 4 bytes constant with value 0:

77 SLT_FIND_FROM_START pic 9(9) comp-5 value x"00000000".

Hope this hepls
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.