GnuCOBOL  2.0
A free COBOL compiler
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
common.h File Reference
#include <setjmp.h>
#include <libcob/exception.def>
Include dependency graph for common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  cob_field_attr
 
struct  cob_field
 
struct  cob_fp_128
 
struct  cob_decimal
 
struct  cob_frame
 
union  cob_content
 
union  cob_call_union
 
struct  cob_call_struct
 
struct  __cob_screen
 
struct  __cob_module
 
struct  cob_func_loc
 
struct  cob_file_key
 
struct  cob_file
 
struct  cob_linage
 
struct  cob_report
 
struct  __cob_global
 
struct  cob_fileio_funcs
 
struct  cobjmp_buf
 
struct  longoption_def
 

Macros

#define cob_c8_t   char
 
#define cob_s8_t   signed char
 
#define cob_u8_t   unsigned char
 
#define cob_s16_t   short
 
#define cob_u16_t   unsigned short
 
#define cob_s32_t   int
 
#define cob_u32_t   unsigned int
 
#define cob_sli_t   long int
 
#define cob_uli_t   unsigned long int
 
#define cob_s64_t   long long
 
#define cob_u64_t   unsigned long long
 
#define COB_S64_C(x)   x ## LL
 
#define COB_U64_C(x)   x ## ULL
 
#define CB_FMT_LLD   "%lld"
 
#define CB_FMT_LLU   "%llu"
 
#define CB_FMT_PLLD   "%+*.*lld"
 
#define CB_FMT_PLLU   "%*.*llu"
 
#define CB_FMT_LLD_F   "%lldLL"
 
#define CB_FMT_LLU_F   "%lluULL"
 
#define cob_c8_ptr   cob_c8_t *
 
#define cob_u8_ptr   cob_u8_t *
 
#define cob_s8_ptr   cob_s8_t *
 
#define cob_u16_ptr   cob_u16_t *
 
#define cob_s16_ptr   cob_s16_t *
 
#define cob_u32_ptr   cob_u32_t *
 
#define cob_s32_ptr   cob_s32_t *
 
#define cob_u64_ptr   cob_u64_t *
 
#define cob_s64_ptr   cob_s64_t *
 
#define cob_void_ptr   void *
 
#define cob_field_ptr   cob_field *
 
#define cob_file_ptr   cob_file *
 
#define cob_module_ptr   cob_module *
 
#define cob_screen_ptr   cob_screen *
 
#define cob_file_key_ptr   cob_file_key *
 
#define COB_BSWAP_16_CONSTANT(val)
 
#define COB_BSWAP_32_CONSTANT(val)
 
#define COB_BSWAP_64_CONSTANT(val)
 
#define COB_BSWAP_16(val)   (COB_BSWAP_16_CONSTANT (val))
 
#define COB_BSWAP_32(val)   (COB_BSWAP_32_CONSTANT (val))
 
#define COB_BSWAP_64(val)   (COB_BSWAP_64_CONSTANT (val))
 
#define COB_EXPIMP   extern
 
#define COB_INLINE   COB_KEYWORD_INLINE
 
#define COB_A_NORETURN
 
#define COB_A_FORMAT12
 
#define COB_A_FORMAT23
 
#define COB_A_FORMAT34
 
#define DECLNORET
 
#define optim_memcpy(x, y, z)   memcpy (x, y, z)
 
#define likely(x)   (x)
 
#define unlikely(x)   (x)
 
#define COB_A_MALLOC
 
#define COB_NOINLINE
 
#define COB_A_INLINE
 
#define COB_A_COLD
 
#define COB_NON_ALIGNED
 
#define __unaligned
 
#define PATHSEPC   ':'
 
#define PATHSEPS   ":"
 
#define SLASH_INT   '/'
 
#define SLASH_STR   "/"
 
#define COB_UNUSED(z)   do { (void)(z); } while (0)
 
#define COB_MINI_BUFF   256
 
#define COB_SMALL_BUFF   1024
 
#define COB_NORMAL_BUFF   2048
 
#define COB_FILE_BUFF   4096
 
#define COB_MEDIUM_BUFF   8192
 
#define COB_LARGE_BUFF   16384
 
#define COB_MINI_MAX   (COB_MINI_BUFF - 1)
 
#define COB_SMALL_MAX   (COB_SMALL_BUFF - 1)
 
#define COB_NORMAL_MAX   (COB_NORMAL_BUFF - 1)
 
#define COB_FILE_MAX   (COB_FILE_BUFF - 1)
 
#define COB_MEDIUM_MAX   (COB_MEDIUM_BUFF - 1)
 
#define COB_LARGE_MAX   (COB_LARGE_BUFF - 1)
 
#define COB_STACK_SIZE   255
 
#define MAX_FD_RECORD   65535
 
#define COB_MAX_FIELD_PARAMS   36
 
#define COB_MAX_DIGITS   38
 
#define COB_MAX_BINARY   39
 
#define COB_MAX_FIELD_SIZE   268435456
 
#define COB_MAX_DEC_STRUCT   32
 
#define COB_MAX_WORDLEN   61
 
#define COB_SORT_MEMORY   128 * 1024 * 1024
 
#define COB_SORT_CHUNK   256 * 1024
 
#define COB_RET_TYPE_INT   0
 
#define COB_RET_TYPE_PTR   1
 
#define COB_RET_TYPE_VOID   2
 
#define COB_FOLD_UPPER   1
 
#define COB_FOLD_LOWER   2
 
#define COB_LC_COLLATE   0
 
#define COB_LC_CTYPE   1
 
#define COB_LC_MESSAGES   2
 
#define COB_LC_MONETARY   3
 
#define COB_LC_NUMERIC   4
 
#define COB_LC_TIME   5
 
#define COB_LC_ALL   6
 
#define COB_LC_USER   7
 
#define COB_LC_CLASS   8
 
#define COB_TYPE_UNKNOWN   0x00
 
#define COB_TYPE_GROUP   0x01U
 
#define COB_TYPE_BOOLEAN   0x02U
 
#define COB_TYPE_NUMERIC   0x10U
 
#define COB_TYPE_NUMERIC_DISPLAY   0x10U
 
#define COB_TYPE_NUMERIC_BINARY   0x11U
 
#define COB_TYPE_NUMERIC_PACKED   0x12U
 
#define COB_TYPE_NUMERIC_FLOAT   0x13U
 
#define COB_TYPE_NUMERIC_DOUBLE   0x14U
 
#define COB_TYPE_NUMERIC_L_DOUBLE   0x15U
 
#define COB_TYPE_NUMERIC_FP_DEC64   0x16U
 
#define COB_TYPE_NUMERIC_FP_DEC128   0x17U
 
#define COB_TYPE_NUMERIC_FP_BIN32   0x18U
 
#define COB_TYPE_NUMERIC_FP_BIN64   0x19U
 
#define COB_TYPE_NUMERIC_FP_BIN128   0x1AU
 
#define COB_TYPE_NUMERIC_EDITED   0x24U
 
#define COB_TYPE_ALPHANUMERIC   0x21U
 
#define COB_TYPE_ALPHANUMERIC_ALL   0x22U
 
#define COB_TYPE_ALPHANUMERIC_EDITED   0x23U
 
#define COB_TYPE_NATIONAL   0x40U
 
#define COB_TYPE_NATIONAL_EDITED   0x41U
 
#define COB_FLAG_HAVE_SIGN   (1U << 0) /* 0x0001 */
 
#define COB_FLAG_SIGN_SEPARATE   (1U << 1) /* 0x0002 */
 
#define COB_FLAG_SIGN_LEADING   (1U << 2) /* 0x0004 */
 
#define COB_FLAG_BLANK_ZERO   (1U << 3) /* 0x0008 */
 
#define COB_FLAG_JUSTIFIED   (1U << 4) /* 0x0010 */
 
#define COB_FLAG_BINARY_SWAP   (1U << 5) /* 0x0020 */
 
#define COB_FLAG_REAL_BINARY   (1U << 6) /* 0x0040 */
 
#define COB_FLAG_IS_POINTER   (1U << 7) /* 0x0080 */
 
#define COB_FLAG_NO_SIGN_NIBBLE   (1U << 8) /* 0x0100 */
 
#define COB_FLAG_IS_FP   (1U << 9) /* 0x0200 */
 
#define COB_FLAG_REAL_SIGN   (1U << 10) /* 0x0400 */
 
#define COB_FLAG_BINARY_TRUNC   (1U << 11) /* 0x0800 */
 
#define COB_FIELD_HAVE_SIGN(f)   ((f)->attr->flags & COB_FLAG_HAVE_SIGN)
 
#define COB_FIELD_SIGN_SEPARATE(f)   ((f)->attr->flags & COB_FLAG_SIGN_SEPARATE)
 
#define COB_FIELD_SIGN_LEADING(f)   ((f)->attr->flags & COB_FLAG_SIGN_LEADING)
 
#define COB_FIELD_BLANK_ZERO(f)   ((f)->attr->flags & COB_FLAG_BLANK_ZERO)
 
#define COB_FIELD_JUSTIFIED(f)   ((f)->attr->flags & COB_FLAG_JUSTIFIED)
 
#define COB_FIELD_BINARY_SWAP(f)   ((f)->attr->flags & COB_FLAG_BINARY_SWAP)
 
#define COB_FIELD_REAL_BINARY(f)   ((f)->attr->flags & COB_FLAG_REAL_BINARY)
 
#define COB_FIELD_IS_POINTER(f)   ((f)->attr->flags & COB_FLAG_IS_POINTER)
 
#define COB_FIELD_NO_SIGN_NIBBLE(f)   ((f)->attr->flags & COB_FLAG_NO_SIGN_NIBBLE)
 
#define COB_FIELD_IS_FP(f)   ((f)->attr->flags & COB_FLAG_IS_FP)
 
#define COB_FIELD_REAL_SIGN(f)   ((f)->attr->flags & COB_FLAG_REAL_SIGN)
 
#define COB_FIELD_BINARY_TRUNC(f)   ((f)->attr->flags & COB_FLAG_BINARY_TRUNC)
 
#define COB_FLAG_LEADSEP   (COB_FLAG_SIGN_SEPARATE | COB_FLAG_SIGN_LEADING)
 
#define COB_FIELD_SIGN_LEADSEP(f)   (((f)->attr->flags & COB_FLAG_LEADSEP) == COB_FLAG_LEADSEP)
 
#define COB_FIELD_TYPE(f)   ((f)->attr->type)
 
#define COB_FIELD_DIGITS(f)   ((f)->attr->digits)
 
#define COB_FIELD_SCALE(f)   ((f)->attr->scale)
 
#define COB_FIELD_FLAGS(f)   ((f)->attr->flags)
 
#define COB_FIELD_PIC(f)   ((f)->attr->pic)
 
#define COB_FIELD_DATA(f)   ((f)->data + (COB_FIELD_SIGN_LEADSEP (f) ? 1 : 0))
 
#define COB_FIELD_SIZE(f)   (COB_FIELD_SIGN_SEPARATE (f) ? f->size - 1 : f->size)
 
#define COB_FIELD_IS_NUMERIC(f)   (COB_FIELD_TYPE (f) & COB_TYPE_NUMERIC)
 
#define COB_FIELD_IS_NUMDISP(f)   (COB_FIELD_TYPE (f) == COB_TYPE_NUMERIC_DISPLAY)
 
#define COB_FIELD_IS_ALNUM(f)   (COB_FIELD_TYPE (f) == COB_TYPE_ALPHANUMERIC)
 
#define COB_FIELD_IS_NATIONAL(f)   (COB_FIELD_TYPE (f) & COB_TYPE_NATIONAL)
 
#define COB_DISPLAY_SIGN_ASCII   0
 
#define COB_DISPLAY_SIGN_EBCDIC   1
 
#define COB_NATIONAL_SIZE   2
 
#define COB_SET_FLD(v, x, y, z)   (v.size = x, v.data = y, v.attr = z, &v)
 
#define COB_SET_DATA(x, z)   (x.data = z, &x)
 
#define COB_FERROR_NONE   0
 
#define COB_FERROR_CANCEL   1
 
#define COB_FERROR_INITIALIZED   2
 
#define COB_FERROR_CODEGEN   3
 
#define COB_FERROR_CHAINING   4
 
#define COB_FERROR_STACK   5
 
#define COB_FERROR_GLOBAL   6
 
#define COB_FERROR_MEMORY   7
 
#define COB_FERROR_MODULE   8
 
#define COB_FERROR_RECURSIVE   9
 
#define COB_FERROR_SCR_INP   10
 
#define COB_FERROR_FILE   11
 
#define COB_FERROR_FUNCTION   12
 
#define COB_FERROR_FREE   13
 
#define COB_EXCEPTION(code, tag, name, critical)   tag,
 
#define COB_FILE_VERSION   1
 
#define COB_EQ   1 /* x == y */
 
#define COB_LT   2 /* x < y */
 
#define COB_LE   3 /* x <= y */
 
#define COB_GT   4 /* x > y */
 
#define COB_GE   5 /* x >= y */
 
#define COB_NE   6 /* x != y */
 
#define COB_FI   7 /* First */
 
#define COB_LA   8 /* Last */
 
#define COB_ASCENDING   0
 
#define COB_DESCENDING   1
 
#define COB_FILE_MODE   0644
 
#define COB_ORG_SEQUENTIAL   0
 
#define COB_ORG_LINE_SEQUENTIAL   1
 
#define COB_ORG_RELATIVE   2
 
#define COB_ORG_INDEXED   3
 
#define COB_ORG_SORT   4
 
#define COB_ORG_MAX   5
 
#define COB_ACCESS_SEQUENTIAL   1
 
#define COB_ACCESS_DYNAMIC   2
 
#define COB_ACCESS_RANDOM   3
 
#define COB_SELECT_FILE_STATUS   (1U << 0)
 
#define COB_SELECT_EXTERNAL   (1U << 1)
 
#define COB_SELECT_LINAGE   (1U << 2)
 
#define COB_SELECT_SPLITKEY   (1U << 3)
 
#define COB_SELECT_STDIN   (1U << 4)
 
#define COB_SELECT_STDOUT   (1U << 5)
 
#define COB_SELECT_TEMPORARY   (1U << 6)
 
#define COB_FILE_SPECIAL(x)   ((x)->flag_select_features & (COB_SELECT_STDIN | COB_SELECT_STDOUT))
 
#define COB_FILE_STDIN(x)   ((x)->flag_select_features & COB_SELECT_STDIN)
 
#define COB_FILE_STDOUT(x)   ((x)->flag_select_features & COB_SELECT_STDOUT)
 
#define COB_FILE_TEMPORARY(x)   ((x)->flag_select_features & COB_SELECT_TEMPORARY)
 
#define COB_LOCK_EXCLUSIVE   (1U << 0)
 
#define COB_LOCK_MANUAL   (1U << 1)
 
#define COB_LOCK_AUTOMATIC   (1U << 2)
 
#define COB_LOCK_MULTIPLE   (1U << 3)
 
#define COB_LOCK_OPEN_EXCLUSIVE   (1U << 4)
 
#define COB_FILE_EXCLUSIVE   (COB_LOCK_EXCLUSIVE | COB_LOCK_OPEN_EXCLUSIVE)
 
#define COB_OPEN_CLOSED   0
 
#define COB_OPEN_INPUT   1
 
#define COB_OPEN_OUTPUT   2
 
#define COB_OPEN_I_O   3
 
#define COB_OPEN_EXTEND   4
 
#define COB_OPEN_LOCKED   5
 
#define COB_CLOSE_NORMAL   0
 
#define COB_CLOSE_LOCK   1
 
#define COB_CLOSE_NO_REWIND   2
 
#define COB_CLOSE_UNIT   3
 
#define COB_CLOSE_UNIT_REMOVAL   4
 
#define COB_WRITE_MASK   0x0000FFFF
 
#define COB_WRITE_LINES   0x00010000
 
#define COB_WRITE_PAGE   0x00020000
 
#define COB_WRITE_CHANNEL   0x00040000
 
#define COB_WRITE_AFTER   0x00100000
 
#define COB_WRITE_BEFORE   0x00200000
 
#define COB_WRITE_EOP   0x00400000
 
#define COB_WRITE_LOCK   0x00800000
 
#define COB_WRITE_NO_LOCK   0x01000000
 
#define COB_READ_NEXT   (1 << 0)
 
#define COB_READ_PREVIOUS   (1 << 1)
 
#define COB_READ_FIRST   (1 << 2)
 
#define COB_READ_LAST   (1 << 3)
 
#define COB_READ_LOCK   (1 << 4)
 
#define COB_READ_NO_LOCK   (1 << 5)
 
#define COB_READ_KEPT_LOCK   (1 << 6)
 
#define COB_READ_WAIT_LOCK   (1 << 7)
 
#define COB_READ_IGNORE_LOCK   (1 << 8)
 
#define COB_READ_MASK   (COB_READ_NEXT | COB_READ_PREVIOUS | COB_READ_FIRST | COB_READ_LAST)
 
#define COB_STATUS_00_SUCCESS   00
 
#define COB_STATUS_02_SUCCESS_DUPLICATE   02
 
#define COB_STATUS_04_SUCCESS_INCOMPLETE   04
 
#define COB_STATUS_05_SUCCESS_OPTIONAL   05
 
#define COB_STATUS_07_SUCCESS_NO_UNIT   07
 
#define COB_STATUS_10_END_OF_FILE   10
 
#define COB_STATUS_14_OUT_OF_KEY_RANGE   14
 
#define COB_STATUS_21_KEY_INVALID   21
 
#define COB_STATUS_22_KEY_EXISTS   22
 
#define COB_STATUS_23_KEY_NOT_EXISTS   23
 
#define COB_STATUS_24_KEY_BOUNDARY   24
 
#define COB_STATUS_30_PERMANENT_ERROR   30
 
#define COB_STATUS_31_INCONSISTENT_FILENAME   31
 
#define COB_STATUS_34_BOUNDARY_VIOLATION   34
 
#define COB_STATUS_35_NOT_EXISTS   35
 
#define COB_STATUS_37_PERMISSION_DENIED   37
 
#define COB_STATUS_38_CLOSED_WITH_LOCK   38
 
#define COB_STATUS_39_CONFLICT_ATTRIBUTE   39
 
#define COB_STATUS_41_ALREADY_OPEN   41
 
#define COB_STATUS_42_NOT_OPEN   42
 
#define COB_STATUS_43_READ_NOT_DONE   43
 
#define COB_STATUS_44_RECORD_OVERFLOW   44
 
#define COB_STATUS_46_READ_ERROR   46
 
#define COB_STATUS_47_INPUT_DENIED   47
 
#define COB_STATUS_48_OUTPUT_DENIED   48
 
#define COB_STATUS_49_I_O_DENIED   49
 
#define COB_STATUS_51_RECORD_LOCKED   51
 
#define COB_STATUS_57_I_O_LINAGE   57
 
#define COB_STATUS_61_FILE_SHARING   61
 
#define COB_STATUS_91_NOT_AVAILABLE   91
 
#define COB_NOT_CONFIGURED   32768
 
#define COB_STORE_ROUND   (1 << 0)
 
#define COB_STORE_KEEP_ON_OVERFLOW   (1 << 1)
 
#define COB_STORE_TRUNC_ON_OVERFLOW   (1 << 2)
 
#define COB_STORE_AWAY_FROM_ZERO   (1 << 4)
 
#define COB_STORE_NEAR_AWAY_FROM_ZERO   (1 << 5)
 
#define COB_STORE_NEAR_EVEN   (1 << 6)
 
#define COB_STORE_NEAR_TOWARD_ZERO   (1 << 7)
 
#define COB_STORE_PROHIBITED   (1 << 8)
 
#define COB_STORE_TOWARD_GREATER   (1 << 9)
 
#define COB_STORE_TOWARD_LESSER   (1 << 10)
 
#define COB_STORE_TRUNCATION   (1 << 11)
 
#define COB_STORE_MASK
 
#define COB_SCREEN_BLACK   0
 
#define COB_SCREEN_BLUE   1
 
#define COB_SCREEN_GREEN   2
 
#define COB_SCREEN_CYAN   3
 
#define COB_SCREEN_RED   4
 
#define COB_SCREEN_MAGENTA   5
 
#define COB_SCREEN_YELLOW   6
 
#define COB_SCREEN_WHITE   7
 
#define COB_SCREEN_LINE_PLUS   (1 << 0)
 
#define COB_SCREEN_LINE_MINUS   (1 << 1)
 
#define COB_SCREEN_COLUMN_PLUS   (1 << 2)
 
#define COB_SCREEN_COLUMN_MINUS   (1 << 3)
 
#define COB_SCREEN_AUTO   (1 << 4)
 
#define COB_SCREEN_BELL   (1 << 5)
 
#define COB_SCREEN_BLANK_LINE   (1 << 6)
 
#define COB_SCREEN_BLANK_SCREEN   (1 << 7)
 
#define COB_SCREEN_BLINK   (1 << 8)
 
#define COB_SCREEN_ERASE_EOL   (1 << 9)
 
#define COB_SCREEN_ERASE_EOS   (1 << 10)
 
#define COB_SCREEN_FULL   (1 << 11)
 
#define COB_SCREEN_HIGHLIGHT   (1 << 12)
 
#define COB_SCREEN_LOWLIGHT   (1 << 13)
 
#define COB_SCREEN_REQUIRED   (1 << 14)
 
#define COB_SCREEN_REVERSE   (1 << 15)
 
#define COB_SCREEN_SECURE   (1 << 16)
 
#define COB_SCREEN_UNDERLINE   (1 << 17)
 
#define COB_SCREEN_OVERLINE   (1 << 18)
 
#define COB_SCREEN_PROMPT   (1 << 19)
 
#define COB_SCREEN_UPDATE   (1 << 20)
 
#define COB_SCREEN_INPUT   (1 << 21)
 
#define COB_SCREEN_SCROLL_DOWN   (1 << 22)
 
#define COB_SCREEN_INITIAL   (1 << 23)
 
#define COB_SCREEN_NO_ECHO   (1 << 24)
 
#define COB_SCREEN_LEFTLINE   (1 << 25)
 
#define COB_SCREEN_NO_DISP   (1 << 26)
 
#define COB_SCREEN_EMULATE_NL   (1 << 27)
 
#define COB_SCREEN_UPPER   (1 << 28)
 
#define COB_SCREEN_LOWER   (1 << 29)
 
#define COB_SCREEN_TYPE_GROUP   0
 
#define COB_SCREEN_TYPE_FIELD   1
 
#define COB_SCREEN_TYPE_VALUE   2
 
#define COB_SCREEN_TYPE_ATTRIBUTE   3
 
#define cobgetenv(x)   cob_getenv (x)
 
#define cobputenv(x)   cob_putenv (x)
 
#define cobtidy()   cob_tidy ()
 
#define cobinit()   cob_extern_init ()
 
#define cobexit(x)   cob_stop_run (x)
 
#define cobcommandline(v, w, x, y, z)   cob_command_line (v,w,x,y,z)
 
#define cobsetjmp(x)   setjmp (cob_savenv (x))
 
#define coblongjmp(x)   cob_longjmp (x)
 
#define cobsavenv(x)   cob_savenv (x)
 
#define cobsavenv2(x, z)   cob_savenv2 (x, z)
 
#define cobfunc(x, y, z)   cob_func (x, y, z)
 
#define cobcall(x, y, z)   cob_call (x, y, z)
 
#define cobcancel(x)   cob_cancel (x)
 
#define cob_c8_t   char
 
#define cob_s8_t   signed char
 
#define cob_u8_t   unsigned char
 
#define cob_s16_t   short
 
#define cob_u16_t   unsigned short
 
#define cob_s32_t   int
 
#define cob_u32_t   unsigned int
 
#define cob_sli_t   long int
 
#define cob_uli_t   unsigned long int
 
#define cob_s64_t   long long
 
#define cob_u64_t   unsigned long long
 
#define COB_S64_C(x)   x ## LL
 
#define COB_U64_C(x)   x ## ULL
 
#define CB_FMT_LLD   "%lld"
 
#define CB_FMT_LLU   "%llu"
 
#define CB_FMT_PLLD   "%+*.*lld"
 
#define CB_FMT_PLLU   "%*.*llu"
 
#define CB_FMT_LLD_F   "%lldLL"
 
#define CB_FMT_LLU_F   "%lluULL"
 
#define cob_c8_ptr   cob_c8_t *
 
#define cob_u8_ptr   cob_u8_t *
 
#define cob_s8_ptr   cob_s8_t *
 
#define cob_u16_ptr   cob_u16_t *
 
#define cob_s16_ptr   cob_s16_t *
 
#define cob_u32_ptr   cob_u32_t *
 
#define cob_s32_ptr   cob_s32_t *
 
#define cob_u64_ptr   cob_u64_t *
 
#define cob_s64_ptr   cob_s64_t *
 
#define cob_void_ptr   void *
 
#define cob_field_ptr   cob_field *
 
#define cob_file_ptr   cob_file *
 
#define cob_module_ptr   cob_module *
 
#define cob_screen_ptr   cob_screen *
 
#define cob_file_key_ptr   cob_file_key *
 
#define COB_BSWAP_16_CONSTANT(val)
 
#define COB_BSWAP_32_CONSTANT(val)
 
#define COB_BSWAP_64_CONSTANT(val)
 
#define COB_BSWAP_16(val)   (COB_BSWAP_16_CONSTANT (val))
 
#define COB_BSWAP_32(val)   (COB_BSWAP_32_CONSTANT (val))
 
#define COB_BSWAP_64(val)   (COB_BSWAP_64_CONSTANT (val))
 
#define COB_EXPIMP   extern
 
#define COB_INLINE   COB_KEYWORD_INLINE
 
#define COB_A_NORETURN
 
#define COB_A_FORMAT12
 
#define COB_A_FORMAT23
 
#define COB_A_FORMAT34
 
#define DECLNORET
 
#define optim_memcpy(x, y, z)   memcpy (x, y, z)
 
#define likely(x)   (x)
 
#define unlikely(x)   (x)
 
#define COB_A_MALLOC
 
#define COB_NOINLINE
 
#define COB_A_INLINE
 
#define COB_A_COLD
 
#define COB_NON_ALIGNED
 
#define __unaligned
 
#define PATHSEPC   ':'
 
#define PATHSEPS   ":"
 
#define SLASH_INT   '/'
 
#define SLASH_STR   "/"
 
#define COB_UNUSED(z)   do { (void)(z); } while (0)
 
#define COB_MINI_BUFF   256
 
#define COB_SMALL_BUFF   1024
 
#define COB_NORMAL_BUFF   2048
 
#define COB_FILE_BUFF   4096
 
#define COB_MEDIUM_BUFF   8192
 
#define COB_LARGE_BUFF   16384
 
#define COB_MINI_MAX   (COB_MINI_BUFF - 1)
 
#define COB_SMALL_MAX   (COB_SMALL_BUFF - 1)
 
#define COB_NORMAL_MAX   (COB_NORMAL_BUFF - 1)
 
#define COB_FILE_MAX   (COB_FILE_BUFF - 1)
 
#define COB_MEDIUM_MAX   (COB_MEDIUM_BUFF - 1)
 
#define COB_LARGE_MAX   (COB_LARGE_BUFF - 1)
 
#define COB_STACK_SIZE   255
 
#define MAX_FD_RECORD   65535
 
#define COB_MAX_FIELD_PARAMS   36
 
#define COB_MAX_DIGITS   38
 
#define COB_MAX_BINARY   39
 
#define COB_MAX_FIELD_SIZE   268435456
 
#define COB_MAX_DEC_STRUCT   32
 
#define COB_MAX_WORDLEN   61
 
#define COB_SORT_MEMORY   128 * 1024 * 1024
 
#define COB_SORT_CHUNK   256 * 1024
 
#define COB_RET_TYPE_INT   0
 
#define COB_RET_TYPE_PTR   1
 
#define COB_RET_TYPE_VOID   2
 
#define COB_FOLD_UPPER   1
 
#define COB_FOLD_LOWER   2
 
#define COB_LC_COLLATE   0
 
#define COB_LC_CTYPE   1
 
#define COB_LC_MESSAGES   2
 
#define COB_LC_MONETARY   3
 
#define COB_LC_NUMERIC   4
 
#define COB_LC_TIME   5
 
#define COB_LC_ALL   6
 
#define COB_LC_USER   7
 
#define COB_LC_CLASS   8
 
#define COB_TYPE_UNKNOWN   0x00
 
#define COB_TYPE_GROUP   0x01U
 
#define COB_TYPE_BOOLEAN   0x02U
 
#define COB_TYPE_NUMERIC   0x10U
 
#define COB_TYPE_NUMERIC_DISPLAY   0x10U
 
#define COB_TYPE_NUMERIC_BINARY   0x11U
 
#define COB_TYPE_NUMERIC_PACKED   0x12U
 
#define COB_TYPE_NUMERIC_FLOAT   0x13U
 
#define COB_TYPE_NUMERIC_DOUBLE   0x14U
 
#define COB_TYPE_NUMERIC_L_DOUBLE   0x15U
 
#define COB_TYPE_NUMERIC_FP_DEC64   0x16U
 
#define COB_TYPE_NUMERIC_FP_DEC128   0x17U
 
#define COB_TYPE_NUMERIC_FP_BIN32   0x18U
 
#define COB_TYPE_NUMERIC_FP_BIN64   0x19U
 
#define COB_TYPE_NUMERIC_FP_BIN128   0x1AU
 
#define COB_TYPE_NUMERIC_EDITED   0x24U
 
#define COB_TYPE_ALPHANUMERIC   0x21U
 
#define COB_TYPE_ALPHANUMERIC_ALL   0x22U
 
#define COB_TYPE_ALPHANUMERIC_EDITED   0x23U
 
#define COB_TYPE_NATIONAL   0x40U
 
#define COB_TYPE_NATIONAL_EDITED   0x41U
 
#define COB_FLAG_HAVE_SIGN   (1U << 0) /* 0x0001 */
 
#define COB_FLAG_SIGN_SEPARATE   (1U << 1) /* 0x0002 */
 
#define COB_FLAG_SIGN_LEADING   (1U << 2) /* 0x0004 */
 
#define COB_FLAG_BLANK_ZERO   (1U << 3) /* 0x0008 */
 
#define COB_FLAG_JUSTIFIED   (1U << 4) /* 0x0010 */
 
#define COB_FLAG_BINARY_SWAP   (1U << 5) /* 0x0020 */
 
#define COB_FLAG_REAL_BINARY   (1U << 6) /* 0x0040 */
 
#define COB_FLAG_IS_POINTER   (1U << 7) /* 0x0080 */
 
#define COB_FLAG_NO_SIGN_NIBBLE   (1U << 8) /* 0x0100 */
 
#define COB_FLAG_IS_FP   (1U << 9) /* 0x0200 */
 
#define COB_FLAG_REAL_SIGN   (1U << 10) /* 0x0400 */
 
#define COB_FLAG_BINARY_TRUNC   (1U << 11) /* 0x0800 */
 
#define COB_FIELD_HAVE_SIGN(f)   ((f)->attr->flags & COB_FLAG_HAVE_SIGN)
 
#define COB_FIELD_SIGN_SEPARATE(f)   ((f)->attr->flags & COB_FLAG_SIGN_SEPARATE)
 
#define COB_FIELD_SIGN_LEADING(f)   ((f)->attr->flags & COB_FLAG_SIGN_LEADING)
 
#define COB_FIELD_BLANK_ZERO(f)   ((f)->attr->flags & COB_FLAG_BLANK_ZERO)
 
#define COB_FIELD_JUSTIFIED(f)   ((f)->attr->flags & COB_FLAG_JUSTIFIED)
 
#define COB_FIELD_BINARY_SWAP(f)   ((f)->attr->flags & COB_FLAG_BINARY_SWAP)
 
#define COB_FIELD_REAL_BINARY(f)   ((f)->attr->flags & COB_FLAG_REAL_BINARY)
 
#define COB_FIELD_IS_POINTER(f)   ((f)->attr->flags & COB_FLAG_IS_POINTER)
 
#define COB_FIELD_NO_SIGN_NIBBLE(f)   ((f)->attr->flags & COB_FLAG_NO_SIGN_NIBBLE)
 
#define COB_FIELD_IS_FP(f)   ((f)->attr->flags & COB_FLAG_IS_FP)
 
#define COB_FIELD_REAL_SIGN(f)   ((f)->attr->flags & COB_FLAG_REAL_SIGN)
 
#define COB_FIELD_BINARY_TRUNC(f)   ((f)->attr->flags & COB_FLAG_BINARY_TRUNC)
 
#define COB_FLAG_LEADSEP   (COB_FLAG_SIGN_SEPARATE | COB_FLAG_SIGN_LEADING)
 
#define COB_FIELD_SIGN_LEADSEP(f)   (((f)->attr->flags & COB_FLAG_LEADSEP) == COB_FLAG_LEADSEP)
 
#define COB_FIELD_TYPE(f)   ((f)->attr->type)
 
#define COB_FIELD_DIGITS(f)   ((f)->attr->digits)
 
#define COB_FIELD_SCALE(f)   ((f)->attr->scale)
 
#define COB_FIELD_FLAGS(f)   ((f)->attr->flags)
 
#define COB_FIELD_PIC(f)   ((f)->attr->pic)
 
#define COB_FIELD_DATA(f)   ((f)->data + (COB_FIELD_SIGN_LEADSEP (f) ? 1 : 0))
 
#define COB_FIELD_SIZE(f)   (COB_FIELD_SIGN_SEPARATE (f) ? f->size - 1 : f->size)
 
#define COB_FIELD_IS_NUMERIC(f)   (COB_FIELD_TYPE (f) & COB_TYPE_NUMERIC)
 
#define COB_FIELD_IS_NUMDISP(f)   (COB_FIELD_TYPE (f) == COB_TYPE_NUMERIC_DISPLAY)
 
#define COB_FIELD_IS_ALNUM(f)   (COB_FIELD_TYPE (f) == COB_TYPE_ALPHANUMERIC)
 
#define COB_FIELD_IS_NATIONAL(f)   (COB_FIELD_TYPE (f) & COB_TYPE_NATIONAL)
 
#define COB_DISPLAY_SIGN_ASCII   0
 
#define COB_DISPLAY_SIGN_EBCDIC   1
 
#define COB_NATIONAL_SIZE   2
 
#define COB_SET_FLD(v, x, y, z)   (v.size = x, v.data = y, v.attr = z, &v)
 
#define COB_SET_DATA(x, z)   (x.data = z, &x)
 
#define COB_FERROR_NONE   0
 
#define COB_FERROR_CANCEL   1
 
#define COB_FERROR_INITIALIZED   2
 
#define COB_FERROR_CODEGEN   3
 
#define COB_FERROR_CHAINING   4
 
#define COB_FERROR_STACK   5
 
#define COB_FERROR_GLOBAL   6
 
#define COB_FERROR_MEMORY   7
 
#define COB_FERROR_MODULE   8
 
#define COB_FERROR_RECURSIVE   9
 
#define COB_FERROR_SCR_INP   10
 
#define COB_FERROR_FILE   11
 
#define COB_FERROR_FUNCTION   12
 
#define COB_FERROR_FREE   13
 
#define COB_EXCEPTION(code, tag, name, critical)   tag,
 
#define COB_FILE_VERSION   1
 
#define COB_EQ   1 /* x == y */
 
#define COB_LT   2 /* x < y */
 
#define COB_LE   3 /* x <= y */
 
#define COB_GT   4 /* x > y */
 
#define COB_GE   5 /* x >= y */
 
#define COB_NE   6 /* x != y */
 
#define COB_FI   7 /* First */
 
#define COB_LA   8 /* Last */
 
#define COB_ASCENDING   0
 
#define COB_DESCENDING   1
 
#define COB_FILE_MODE   0644
 
#define COB_ORG_SEQUENTIAL   0
 
#define COB_ORG_LINE_SEQUENTIAL   1
 
#define COB_ORG_RELATIVE   2
 
#define COB_ORG_INDEXED   3
 
#define COB_ORG_SORT   4
 
#define COB_ORG_MAX   5
 
#define COB_ACCESS_SEQUENTIAL   1
 
#define COB_ACCESS_DYNAMIC   2
 
#define COB_ACCESS_RANDOM   3
 
#define COB_SELECT_FILE_STATUS   (1U << 0)
 
#define COB_SELECT_EXTERNAL   (1U << 1)
 
#define COB_SELECT_LINAGE   (1U << 2)
 
#define COB_SELECT_SPLITKEY   (1U << 3)
 
#define COB_SELECT_STDIN   (1U << 4)
 
#define COB_SELECT_STDOUT   (1U << 5)
 
#define COB_SELECT_TEMPORARY   (1U << 6)
 
#define COB_FILE_SPECIAL(x)   ((x)->flag_select_features & (COB_SELECT_STDIN | COB_SELECT_STDOUT))
 
#define COB_FILE_STDIN(x)   ((x)->flag_select_features & COB_SELECT_STDIN)
 
#define COB_FILE_STDOUT(x)   ((x)->flag_select_features & COB_SELECT_STDOUT)
 
#define COB_FILE_TEMPORARY(x)   ((x)->flag_select_features & COB_SELECT_TEMPORARY)
 
#define COB_LOCK_EXCLUSIVE   (1U << 0)
 
#define COB_LOCK_MANUAL   (1U << 1)
 
#define COB_LOCK_AUTOMATIC   (1U << 2)
 
#define COB_LOCK_MULTIPLE   (1U << 3)
 
#define COB_LOCK_OPEN_EXCLUSIVE   (1U << 4)
 
#define COB_FILE_EXCLUSIVE   (COB_LOCK_EXCLUSIVE | COB_LOCK_OPEN_EXCLUSIVE)
 
#define COB_OPEN_CLOSED   0
 
#define COB_OPEN_INPUT   1
 
#define COB_OPEN_OUTPUT   2
 
#define COB_OPEN_I_O   3
 
#define COB_OPEN_EXTEND   4
 
#define COB_OPEN_LOCKED   5
 
#define COB_CLOSE_NORMAL   0
 
#define COB_CLOSE_LOCK   1
 
#define COB_CLOSE_NO_REWIND   2
 
#define COB_CLOSE_UNIT   3
 
#define COB_CLOSE_UNIT_REMOVAL   4
 
#define COB_WRITE_MASK   0x0000FFFF
 
#define COB_WRITE_LINES   0x00010000
 
#define COB_WRITE_PAGE   0x00020000
 
#define COB_WRITE_CHANNEL   0x00040000
 
#define COB_WRITE_AFTER   0x00100000
 
#define COB_WRITE_BEFORE   0x00200000
 
#define COB_WRITE_EOP   0x00400000
 
#define COB_WRITE_LOCK   0x00800000
 
#define COB_WRITE_NO_LOCK   0x01000000
 
#define COB_READ_NEXT   (1 << 0)
 
#define COB_READ_PREVIOUS   (1 << 1)
 
#define COB_READ_FIRST   (1 << 2)
 
#define COB_READ_LAST   (1 << 3)
 
#define COB_READ_LOCK   (1 << 4)
 
#define COB_READ_NO_LOCK   (1 << 5)
 
#define COB_READ_KEPT_LOCK   (1 << 6)
 
#define COB_READ_WAIT_LOCK   (1 << 7)
 
#define COB_READ_IGNORE_LOCK   (1 << 8)
 
#define COB_READ_MASK   (COB_READ_NEXT | COB_READ_PREVIOUS | COB_READ_FIRST | COB_READ_LAST)
 
#define COB_STATUS_00_SUCCESS   00
 
#define COB_STATUS_02_SUCCESS_DUPLICATE   02
 
#define COB_STATUS_04_SUCCESS_INCOMPLETE   04
 
#define COB_STATUS_05_SUCCESS_OPTIONAL   05
 
#define COB_STATUS_07_SUCCESS_NO_UNIT   07
 
#define COB_STATUS_10_END_OF_FILE   10
 
#define COB_STATUS_14_OUT_OF_KEY_RANGE   14
 
#define COB_STATUS_21_KEY_INVALID   21
 
#define COB_STATUS_22_KEY_EXISTS   22
 
#define COB_STATUS_23_KEY_NOT_EXISTS   23
 
#define COB_STATUS_24_KEY_BOUNDARY   24
 
#define COB_STATUS_30_PERMANENT_ERROR   30
 
#define COB_STATUS_31_INCONSISTENT_FILENAME   31
 
#define COB_STATUS_34_BOUNDARY_VIOLATION   34
 
#define COB_STATUS_35_NOT_EXISTS   35
 
#define COB_STATUS_37_PERMISSION_DENIED   37
 
#define COB_STATUS_38_CLOSED_WITH_LOCK   38
 
#define COB_STATUS_39_CONFLICT_ATTRIBUTE   39
 
#define COB_STATUS_41_ALREADY_OPEN   41
 
#define COB_STATUS_42_NOT_OPEN   42
 
#define COB_STATUS_43_READ_NOT_DONE   43
 
#define COB_STATUS_44_RECORD_OVERFLOW   44
 
#define COB_STATUS_46_READ_ERROR   46
 
#define COB_STATUS_47_INPUT_DENIED   47
 
#define COB_STATUS_48_OUTPUT_DENIED   48
 
#define COB_STATUS_49_I_O_DENIED   49
 
#define COB_STATUS_51_RECORD_LOCKED   51
 
#define COB_STATUS_57_I_O_LINAGE   57
 
#define COB_STATUS_61_FILE_SHARING   61
 
#define COB_STATUS_91_NOT_AVAILABLE   91
 
#define COB_NOT_CONFIGURED   32768
 
#define COB_STORE_ROUND   (1 << 0)
 
#define COB_STORE_KEEP_ON_OVERFLOW   (1 << 1)
 
#define COB_STORE_TRUNC_ON_OVERFLOW   (1 << 2)
 
#define COB_STORE_AWAY_FROM_ZERO   (1 << 4)
 
#define COB_STORE_NEAR_AWAY_FROM_ZERO   (1 << 5)
 
#define COB_STORE_NEAR_EVEN   (1 << 6)
 
#define COB_STORE_NEAR_TOWARD_ZERO   (1 << 7)
 
#define COB_STORE_PROHIBITED   (1 << 8)
 
#define COB_STORE_TOWARD_GREATER   (1 << 9)
 
#define COB_STORE_TOWARD_LESSER   (1 << 10)
 
#define COB_STORE_TRUNCATION   (1 << 11)
 
#define COB_STORE_MASK
 
#define COB_SCREEN_BLACK   0
 
#define COB_SCREEN_BLUE   1
 
#define COB_SCREEN_GREEN   2
 
#define COB_SCREEN_CYAN   3
 
#define COB_SCREEN_RED   4
 
#define COB_SCREEN_MAGENTA   5
 
#define COB_SCREEN_YELLOW   6
 
#define COB_SCREEN_WHITE   7
 
#define COB_SCREEN_LINE_PLUS   (1 << 0)
 
#define COB_SCREEN_LINE_MINUS   (1 << 1)
 
#define COB_SCREEN_COLUMN_PLUS   (1 << 2)
 
#define COB_SCREEN_COLUMN_MINUS   (1 << 3)
 
#define COB_SCREEN_AUTO   (1 << 4)
 
#define COB_SCREEN_BELL   (1 << 5)
 
#define COB_SCREEN_BLANK_LINE   (1 << 6)
 
#define COB_SCREEN_BLANK_SCREEN   (1 << 7)
 
#define COB_SCREEN_BLINK   (1 << 8)
 
#define COB_SCREEN_ERASE_EOL   (1 << 9)
 
#define COB_SCREEN_ERASE_EOS   (1 << 10)
 
#define COB_SCREEN_FULL   (1 << 11)
 
#define COB_SCREEN_HIGHLIGHT   (1 << 12)
 
#define COB_SCREEN_LOWLIGHT   (1 << 13)
 
#define COB_SCREEN_REQUIRED   (1 << 14)
 
#define COB_SCREEN_REVERSE   (1 << 15)
 
#define COB_SCREEN_SECURE   (1 << 16)
 
#define COB_SCREEN_UNDERLINE   (1 << 17)
 
#define COB_SCREEN_OVERLINE   (1 << 18)
 
#define COB_SCREEN_PROMPT   (1 << 19)
 
#define COB_SCREEN_UPDATE   (1 << 20)
 
#define COB_SCREEN_INPUT   (1 << 21)
 
#define COB_SCREEN_SCROLL_DOWN   (1 << 22)
 
#define COB_SCREEN_INITIAL   (1 << 23)
 
#define COB_SCREEN_NO_ECHO   (1 << 24)
 
#define COB_SCREEN_LEFTLINE   (1 << 25)
 
#define COB_SCREEN_NO_DISP   (1 << 26)
 
#define COB_SCREEN_EMULATE_NL   (1 << 27)
 
#define COB_SCREEN_UPPER   (1 << 28)
 
#define COB_SCREEN_LOWER   (1 << 29)
 
#define COB_SCREEN_TYPE_GROUP   0
 
#define COB_SCREEN_TYPE_FIELD   1
 
#define COB_SCREEN_TYPE_VALUE   2
 
#define COB_SCREEN_TYPE_ATTRIBUTE   3
 
#define cobgetenv(x)   cob_getenv (x)
 
#define cobputenv(x)   cob_putenv (x)
 
#define cobtidy()   cob_tidy ()
 
#define cobinit()   cob_extern_init ()
 
#define cobexit(x)   cob_stop_run (x)
 
#define cobcommandline(v, w, x, y, z)   cob_command_line (v,w,x,y,z)
 
#define cobsetjmp(x)   setjmp (cob_savenv (x))
 
#define coblongjmp(x)   cob_longjmp (x)
 
#define cobsavenv(x)   cob_savenv (x)
 
#define cobsavenv2(x, z)   cob_savenv2 (x, z)
 
#define cobfunc(x, y, z)   cob_func (x, y, z)
 
#define cobcall(x, y, z)   cob_call (x, y, z)
 
#define cobcancel(x)   cob_cancel (x)
 
#define cob_c8_t   char
 
#define cob_s8_t   signed char
 
#define cob_u8_t   unsigned char
 
#define cob_s16_t   short
 
#define cob_u16_t   unsigned short
 
#define cob_s32_t   int
 
#define cob_u32_t   unsigned int
 
#define cob_sli_t   long int
 
#define cob_uli_t   unsigned long int
 
#define cob_s64_t   long long
 
#define cob_u64_t   unsigned long long
 
#define COB_S64_C(x)   x ## LL
 
#define COB_U64_C(x)   x ## ULL
 
#define CB_FMT_LLD   "%lld"
 
#define CB_FMT_LLU   "%llu"
 
#define CB_FMT_PLLD   "%+*.*lld"
 
#define CB_FMT_PLLU   "%*.*llu"
 
#define CB_FMT_LLD_F   "%lldLL"
 
#define CB_FMT_LLU_F   "%lluULL"
 
#define cob_c8_ptr   cob_c8_t *
 
#define cob_u8_ptr   cob_u8_t *
 
#define cob_s8_ptr   cob_s8_t *
 
#define cob_u16_ptr   cob_u16_t *
 
#define cob_s16_ptr   cob_s16_t *
 
#define cob_u32_ptr   cob_u32_t *
 
#define cob_s32_ptr   cob_s32_t *
 
#define cob_u64_ptr   cob_u64_t *
 
#define cob_s64_ptr   cob_s64_t *
 
#define cob_void_ptr   void *
 
#define cob_field_ptr   cob_field *
 
#define cob_file_ptr   cob_file *
 
#define cob_module_ptr   cob_module *
 
#define cob_screen_ptr   cob_screen *
 
#define cob_file_key_ptr   cob_file_key *
 
#define COB_BSWAP_16_CONSTANT(val)
 
#define COB_BSWAP_32_CONSTANT(val)
 
#define COB_BSWAP_64_CONSTANT(val)
 
#define COB_BSWAP_16(val)   (COB_BSWAP_16_CONSTANT (val))
 
#define COB_BSWAP_32(val)   (COB_BSWAP_32_CONSTANT (val))
 
#define COB_BSWAP_64(val)   (COB_BSWAP_64_CONSTANT (val))
 
#define COB_EXPIMP   extern
 
#define COB_INLINE   COB_KEYWORD_INLINE
 
#define COB_A_NORETURN
 
#define COB_A_FORMAT12
 
#define COB_A_FORMAT23
 
#define COB_A_FORMAT34
 
#define DECLNORET
 
#define optim_memcpy(x, y, z)   memcpy (x, y, z)
 
#define likely(x)   (x)
 
#define unlikely(x)   (x)
 
#define COB_A_MALLOC
 
#define COB_NOINLINE
 
#define COB_A_INLINE
 
#define COB_A_COLD
 
#define COB_NON_ALIGNED
 
#define __unaligned
 
#define PATHSEPC   ':'
 
#define PATHSEPS   ":"
 
#define SLASH_INT   '/'
 
#define SLASH_STR   "/"
 
#define COB_UNUSED(z)   do { (void)(z); } while (0)
 
#define COB_MINI_BUFF   256
 
#define COB_SMALL_BUFF   1024
 
#define COB_NORMAL_BUFF   2048
 
#define COB_FILE_BUFF   4096
 
#define COB_MEDIUM_BUFF   8192
 
#define COB_LARGE_BUFF   16384
 
#define COB_MINI_MAX   (COB_MINI_BUFF - 1)
 
#define COB_SMALL_MAX   (COB_SMALL_BUFF - 1)
 
#define COB_NORMAL_MAX   (COB_NORMAL_BUFF - 1)
 
#define COB_FILE_MAX   (COB_FILE_BUFF - 1)
 
#define COB_MEDIUM_MAX   (COB_MEDIUM_BUFF - 1)
 
#define COB_LARGE_MAX   (COB_LARGE_BUFF - 1)
 
#define COB_STACK_SIZE   255
 
#define MAX_FD_RECORD   65535
 
#define COB_MAX_FIELD_PARAMS   36
 
#define COB_MAX_DIGITS   38
 
#define COB_MAX_BINARY   39
 
#define COB_MAX_FIELD_SIZE   268435456
 
#define COB_MAX_DEC_STRUCT   32
 
#define COB_MAX_WORDLEN   61
 
#define COB_SORT_MEMORY   128 * 1024 * 1024
 
#define COB_SORT_CHUNK   256 * 1024
 
#define COB_RET_TYPE_INT   0
 
#define COB_RET_TYPE_PTR   1
 
#define COB_RET_TYPE_VOID   2
 
#define COB_FOLD_UPPER   1
 
#define COB_FOLD_LOWER   2
 
#define COB_LC_COLLATE   0
 
#define COB_LC_CTYPE   1
 
#define COB_LC_MESSAGES   2
 
#define COB_LC_MONETARY   3
 
#define COB_LC_NUMERIC   4
 
#define COB_LC_TIME   5
 
#define COB_LC_ALL   6
 
#define COB_LC_USER   7
 
#define COB_LC_CLASS   8
 
#define COB_TYPE_UNKNOWN   0x00
 
#define COB_TYPE_GROUP   0x01U
 
#define COB_TYPE_BOOLEAN   0x02U
 
#define COB_TYPE_NUMERIC   0x10U
 
#define COB_TYPE_NUMERIC_DISPLAY   0x10U
 
#define COB_TYPE_NUMERIC_BINARY   0x11U
 
#define COB_TYPE_NUMERIC_PACKED   0x12U
 
#define COB_TYPE_NUMERIC_FLOAT   0x13U
 
#define COB_TYPE_NUMERIC_DOUBLE   0x14U
 
#define COB_TYPE_NUMERIC_L_DOUBLE   0x15U
 
#define COB_TYPE_NUMERIC_FP_DEC64   0x16U
 
#define COB_TYPE_NUMERIC_FP_DEC128   0x17U
 
#define COB_TYPE_NUMERIC_FP_BIN32   0x18U
 
#define COB_TYPE_NUMERIC_FP_BIN64   0x19U
 
#define COB_TYPE_NUMERIC_FP_BIN128   0x1AU
 
#define COB_TYPE_NUMERIC_EDITED   0x24U
 
#define COB_TYPE_ALPHANUMERIC   0x21U
 
#define COB_TYPE_ALPHANUMERIC_ALL   0x22U
 
#define COB_TYPE_ALPHANUMERIC_EDITED   0x23U
 
#define COB_TYPE_NATIONAL   0x40U
 
#define COB_TYPE_NATIONAL_EDITED   0x41U
 
#define COB_FLAG_HAVE_SIGN   (1U << 0) /* 0x0001 */
 
#define COB_FLAG_SIGN_SEPARATE   (1U << 1) /* 0x0002 */
 
#define COB_FLAG_SIGN_LEADING   (1U << 2) /* 0x0004 */
 
#define COB_FLAG_BLANK_ZERO   (1U << 3) /* 0x0008 */
 
#define COB_FLAG_JUSTIFIED   (1U << 4) /* 0x0010 */
 
#define COB_FLAG_BINARY_SWAP   (1U << 5) /* 0x0020 */
 
#define COB_FLAG_REAL_BINARY   (1U << 6) /* 0x0040 */
 
#define COB_FLAG_IS_POINTER   (1U << 7) /* 0x0080 */
 
#define COB_FLAG_NO_SIGN_NIBBLE   (1U << 8) /* 0x0100 */
 
#define COB_FLAG_IS_FP   (1U << 9) /* 0x0200 */
 
#define COB_FLAG_REAL_SIGN   (1U << 10) /* 0x0400 */
 
#define COB_FLAG_BINARY_TRUNC   (1U << 11) /* 0x0800 */
 
#define COB_FIELD_HAVE_SIGN(f)   ((f)->attr->flags & COB_FLAG_HAVE_SIGN)
 
#define COB_FIELD_SIGN_SEPARATE(f)   ((f)->attr->flags & COB_FLAG_SIGN_SEPARATE)
 
#define COB_FIELD_SIGN_LEADING(f)   ((f)->attr->flags & COB_FLAG_SIGN_LEADING)
 
#define COB_FIELD_BLANK_ZERO(f)   ((f)->attr->flags & COB_FLAG_BLANK_ZERO)
 
#define COB_FIELD_JUSTIFIED(f)   ((f)->attr->flags & COB_FLAG_JUSTIFIED)
 
#define COB_FIELD_BINARY_SWAP(f)   ((f)->attr->flags & COB_FLAG_BINARY_SWAP)
 
#define COB_FIELD_REAL_BINARY(f)   ((f)->attr->flags & COB_FLAG_REAL_BINARY)
 
#define COB_FIELD_IS_POINTER(f)   ((f)->attr->flags & COB_FLAG_IS_POINTER)
 
#define COB_FIELD_NO_SIGN_NIBBLE(f)   ((f)->attr->flags & COB_FLAG_NO_SIGN_NIBBLE)
 
#define COB_FIELD_IS_FP(f)   ((f)->attr->flags & COB_FLAG_IS_FP)
 
#define COB_FIELD_REAL_SIGN(f)   ((f)->attr->flags & COB_FLAG_REAL_SIGN)
 
#define COB_FIELD_BINARY_TRUNC(f)   ((f)->attr->flags & COB_FLAG_BINARY_TRUNC)
 
#define COB_FLAG_LEADSEP   (COB_FLAG_SIGN_SEPARATE | COB_FLAG_SIGN_LEADING)
 
#define COB_FIELD_SIGN_LEADSEP(f)   (((f)->attr->flags & COB_FLAG_LEADSEP) == COB_FLAG_LEADSEP)
 
#define COB_FIELD_TYPE(f)   ((f)->attr->type)
 
#define COB_FIELD_DIGITS(f)   ((f)->attr->digits)
 
#define COB_FIELD_SCALE(f)   ((f)->attr->scale)
 
#define COB_FIELD_FLAGS(f)   ((f)->attr->flags)
 
#define COB_FIELD_PIC(f)   ((f)->attr->pic)
 
#define COB_FIELD_DATA(f)   ((f)->data + (COB_FIELD_SIGN_LEADSEP (f) ? 1 : 0))
 
#define COB_FIELD_SIZE(f)   (COB_FIELD_SIGN_SEPARATE (f) ? f->size - 1 : f->size)
 
#define COB_FIELD_IS_NUMERIC(f)   (COB_FIELD_TYPE (f) & COB_TYPE_NUMERIC)
 
#define COB_FIELD_IS_NUMDISP(f)   (COB_FIELD_TYPE (f) == COB_TYPE_NUMERIC_DISPLAY)
 
#define COB_FIELD_IS_ALNUM(f)   (COB_FIELD_TYPE (f) == COB_TYPE_ALPHANUMERIC)
 
#define COB_FIELD_IS_NATIONAL(f)   (COB_FIELD_TYPE (f) & COB_TYPE_NATIONAL)
 
#define COB_DISPLAY_SIGN_ASCII   0
 
#define COB_DISPLAY_SIGN_EBCDIC   1
 
#define COB_NATIONAL_SIZE   2
 
#define COB_SET_FLD(v, x, y, z)   (v.size = x, v.data = y, v.attr = z, &v)
 
#define COB_SET_DATA(x, z)   (x.data = z, &x)
 
#define COB_FERROR_NONE   0
 
#define COB_FERROR_CANCEL   1
 
#define COB_FERROR_INITIALIZED   2
 
#define COB_FERROR_CODEGEN   3
 
#define COB_FERROR_CHAINING   4
 
#define COB_FERROR_STACK   5
 
#define COB_FERROR_GLOBAL   6
 
#define COB_FERROR_MEMORY   7
 
#define COB_FERROR_MODULE   8
 
#define COB_FERROR_RECURSIVE   9
 
#define COB_FERROR_SCR_INP   10
 
#define COB_FERROR_FILE   11
 
#define COB_FERROR_FUNCTION   12
 
#define COB_FERROR_FREE   13
 
#define COB_EXCEPTION(code, tag, name, critical)   tag,
 
#define COB_FILE_VERSION   1
 
#define COB_EQ   1 /* x == y */
 
#define COB_LT   2 /* x < y */
 
#define COB_LE   3 /* x <= y */
 
#define COB_GT   4 /* x > y */
 
#define COB_GE   5 /* x >= y */
 
#define COB_NE   6 /* x != y */
 
#define COB_FI   7 /* First */
 
#define COB_LA   8 /* Last */
 
#define COB_ASCENDING   0
 
#define COB_DESCENDING   1
 
#define COB_FILE_MODE   0644
 
#define COB_ORG_SEQUENTIAL   0
 
#define COB_ORG_LINE_SEQUENTIAL   1
 
#define COB_ORG_RELATIVE   2
 
#define COB_ORG_INDEXED   3
 
#define COB_ORG_SORT   4
 
#define COB_ORG_MAX   5
 
#define COB_ACCESS_SEQUENTIAL   1
 
#define COB_ACCESS_DYNAMIC   2
 
#define COB_ACCESS_RANDOM   3
 
#define COB_SELECT_FILE_STATUS   (1U << 0)
 
#define COB_SELECT_EXTERNAL   (1U << 1)
 
#define COB_SELECT_LINAGE   (1U << 2)
 
#define COB_SELECT_SPLITKEY   (1U << 3)
 
#define COB_SELECT_STDIN   (1U << 4)
 
#define COB_SELECT_STDOUT   (1U << 5)
 
#define COB_SELECT_TEMPORARY   (1U << 6)
 
#define COB_FILE_SPECIAL(x)   ((x)->flag_select_features & (COB_SELECT_STDIN | COB_SELECT_STDOUT))
 
#define COB_FILE_STDIN(x)   ((x)->flag_select_features & COB_SELECT_STDIN)
 
#define COB_FILE_STDOUT(x)   ((x)->flag_select_features & COB_SELECT_STDOUT)
 
#define COB_FILE_TEMPORARY(x)   ((x)->flag_select_features & COB_SELECT_TEMPORARY)
 
#define COB_LOCK_EXCLUSIVE   (1U << 0)
 
#define COB_LOCK_MANUAL   (1U << 1)
 
#define COB_LOCK_AUTOMATIC   (1U << 2)
 
#define COB_LOCK_MULTIPLE   (1U << 3)
 
#define COB_LOCK_OPEN_EXCLUSIVE   (1U << 4)
 
#define COB_FILE_EXCLUSIVE   (COB_LOCK_EXCLUSIVE | COB_LOCK_OPEN_EXCLUSIVE)
 
#define COB_OPEN_CLOSED   0
 
#define COB_OPEN_INPUT   1
 
#define COB_OPEN_OUTPUT   2
 
#define COB_OPEN_I_O   3
 
#define COB_OPEN_EXTEND   4
 
#define COB_OPEN_LOCKED   5
 
#define COB_CLOSE_NORMAL   0
 
#define COB_CLOSE_LOCK   1
 
#define COB_CLOSE_NO_REWIND   2
 
#define COB_CLOSE_UNIT   3
 
#define COB_CLOSE_UNIT_REMOVAL   4
 
#define COB_WRITE_MASK   0x0000FFFF
 
#define COB_WRITE_LINES   0x00010000
 
#define COB_WRITE_PAGE   0x00020000
 
#define COB_WRITE_CHANNEL   0x00040000
 
#define COB_WRITE_AFTER   0x00100000
 
#define COB_WRITE_BEFORE   0x00200000
 
#define COB_WRITE_EOP   0x00400000
 
#define COB_WRITE_LOCK   0x00800000
 
#define COB_WRITE_NO_LOCK   0x01000000
 
#define COB_READ_NEXT   (1 << 0)
 
#define COB_READ_PREVIOUS   (1 << 1)
 
#define COB_READ_FIRST   (1 << 2)
 
#define COB_READ_LAST   (1 << 3)
 
#define COB_READ_LOCK   (1 << 4)
 
#define COB_READ_NO_LOCK   (1 << 5)
 
#define COB_READ_KEPT_LOCK   (1 << 6)
 
#define COB_READ_WAIT_LOCK   (1 << 7)
 
#define COB_READ_IGNORE_LOCK   (1 << 8)
 
#define COB_READ_MASK   (COB_READ_NEXT | COB_READ_PREVIOUS | COB_READ_FIRST | COB_READ_LAST)
 
#define COB_STATUS_00_SUCCESS   00
 
#define COB_STATUS_02_SUCCESS_DUPLICATE   02
 
#define COB_STATUS_04_SUCCESS_INCOMPLETE   04
 
#define COB_STATUS_05_SUCCESS_OPTIONAL   05
 
#define COB_STATUS_07_SUCCESS_NO_UNIT   07
 
#define COB_STATUS_10_END_OF_FILE   10
 
#define COB_STATUS_14_OUT_OF_KEY_RANGE   14
 
#define COB_STATUS_21_KEY_INVALID   21
 
#define COB_STATUS_22_KEY_EXISTS   22
 
#define COB_STATUS_23_KEY_NOT_EXISTS   23
 
#define COB_STATUS_24_KEY_BOUNDARY   24
 
#define COB_STATUS_30_PERMANENT_ERROR   30
 
#define COB_STATUS_31_INCONSISTENT_FILENAME   31
 
#define COB_STATUS_34_BOUNDARY_VIOLATION   34
 
#define COB_STATUS_35_NOT_EXISTS   35
 
#define COB_STATUS_37_PERMISSION_DENIED   37
 
#define COB_STATUS_38_CLOSED_WITH_LOCK   38
 
#define COB_STATUS_39_CONFLICT_ATTRIBUTE   39
 
#define COB_STATUS_41_ALREADY_OPEN   41
 
#define COB_STATUS_42_NOT_OPEN   42
 
#define COB_STATUS_43_READ_NOT_DONE   43
 
#define COB_STATUS_44_RECORD_OVERFLOW   44
 
#define COB_STATUS_46_READ_ERROR   46
 
#define COB_STATUS_47_INPUT_DENIED   47
 
#define COB_STATUS_48_OUTPUT_DENIED   48
 
#define COB_STATUS_49_I_O_DENIED   49
 
#define COB_STATUS_51_RECORD_LOCKED   51
 
#define COB_STATUS_57_I_O_LINAGE   57
 
#define COB_STATUS_61_FILE_SHARING   61
 
#define COB_STATUS_91_NOT_AVAILABLE   91
 
#define COB_NOT_CONFIGURED   32768
 
#define COB_STORE_ROUND   (1 << 0)
 
#define COB_STORE_KEEP_ON_OVERFLOW   (1 << 1)
 
#define COB_STORE_TRUNC_ON_OVERFLOW   (1 << 2)
 
#define COB_STORE_AWAY_FROM_ZERO   (1 << 4)
 
#define COB_STORE_NEAR_AWAY_FROM_ZERO   (1 << 5)
 
#define COB_STORE_NEAR_EVEN   (1 << 6)
 
#define COB_STORE_NEAR_TOWARD_ZERO   (1 << 7)
 
#define COB_STORE_PROHIBITED   (1 << 8)
 
#define COB_STORE_TOWARD_GREATER   (1 << 9)
 
#define COB_STORE_TOWARD_LESSER   (1 << 10)
 
#define COB_STORE_TRUNCATION   (1 << 11)
 
#define COB_STORE_MASK
 
#define COB_SCREEN_BLACK   0
 
#define COB_SCREEN_BLUE   1
 
#define COB_SCREEN_GREEN   2
 
#define COB_SCREEN_CYAN   3
 
#define COB_SCREEN_RED   4
 
#define COB_SCREEN_MAGENTA   5
 
#define COB_SCREEN_YELLOW   6
 
#define COB_SCREEN_WHITE   7
 
#define COB_SCREEN_LINE_PLUS   (1 << 0)
 
#define COB_SCREEN_LINE_MINUS   (1 << 1)
 
#define COB_SCREEN_COLUMN_PLUS   (1 << 2)
 
#define COB_SCREEN_COLUMN_MINUS   (1 << 3)
 
#define COB_SCREEN_AUTO   (1 << 4)
 
#define COB_SCREEN_BELL   (1 << 5)
 
#define COB_SCREEN_BLANK_LINE   (1 << 6)
 
#define COB_SCREEN_BLANK_SCREEN   (1 << 7)
 
#define COB_SCREEN_BLINK   (1 << 8)
 
#define COB_SCREEN_ERASE_EOL   (1 << 9)
 
#define COB_SCREEN_ERASE_EOS   (1 << 10)
 
#define COB_SCREEN_FULL   (1 << 11)
 
#define COB_SCREEN_HIGHLIGHT   (1 << 12)
 
#define COB_SCREEN_LOWLIGHT   (1 << 13)
 
#define COB_SCREEN_REQUIRED   (1 << 14)
 
#define COB_SCREEN_REVERSE   (1 << 15)
 
#define COB_SCREEN_SECURE   (1 << 16)
 
#define COB_SCREEN_UNDERLINE   (1 << 17)
 
#define COB_SCREEN_OVERLINE   (1 << 18)
 
#define COB_SCREEN_PROMPT   (1 << 19)
 
#define COB_SCREEN_UPDATE   (1 << 20)
 
#define COB_SCREEN_INPUT   (1 << 21)
 
#define COB_SCREEN_SCROLL_DOWN   (1 << 22)
 
#define COB_SCREEN_INITIAL   (1 << 23)
 
#define COB_SCREEN_NO_ECHO   (1 << 24)
 
#define COB_SCREEN_LEFTLINE   (1 << 25)
 
#define COB_SCREEN_NO_DISP   (1 << 26)
 
#define COB_SCREEN_EMULATE_NL   (1 << 27)
 
#define COB_SCREEN_UPPER   (1 << 28)
 
#define COB_SCREEN_LOWER   (1 << 29)
 
#define COB_SCREEN_TYPE_GROUP   0
 
#define COB_SCREEN_TYPE_FIELD   1
 
#define COB_SCREEN_TYPE_VALUE   2
 
#define COB_SCREEN_TYPE_ATTRIBUTE   3
 
#define cobgetenv(x)   cob_getenv (x)
 
#define cobputenv(x)   cob_putenv (x)
 
#define cobtidy()   cob_tidy ()
 
#define cobinit()   cob_extern_init ()
 
#define cobexit(x)   cob_stop_run (x)
 
#define cobcommandline(v, w, x, y, z)   cob_command_line (v,w,x,y,z)
 
#define cobsetjmp(x)   setjmp (cob_savenv (x))
 
#define coblongjmp(x)   cob_longjmp (x)
 
#define cobsavenv(x)   cob_savenv (x)
 
#define cobsavenv2(x, z)   cob_savenv2 (x, z)
 
#define cobfunc(x, y, z)   cob_func (x, y, z)
 
#define cobcall(x, y, z)   cob_call (x, y, z)
 
#define cobcancel(x)   cob_cancel (x)
 
#define cob_c8_t   char
 
#define cob_s8_t   signed char
 
#define cob_u8_t   unsigned char
 
#define cob_s16_t   short
 
#define cob_u16_t   unsigned short
 
#define cob_s32_t   int
 
#define cob_u32_t   unsigned int
 
#define cob_sli_t   long int
 
#define cob_uli_t   unsigned long int
 
#define cob_s64_t   long long
 
#define cob_u64_t   unsigned long long
 
#define COB_S64_C(x)   x ## LL
 
#define COB_U64_C(x)   x ## ULL
 
#define CB_FMT_LLD   "%lld"
 
#define CB_FMT_LLU   "%llu"
 
#define CB_FMT_PLLD   "%+*.*lld"
 
#define CB_FMT_PLLU   "%*.*llu"
 
#define CB_FMT_LLD_F   "%lldLL"
 
#define CB_FMT_LLU_F   "%lluULL"
 
#define cob_c8_ptr   cob_c8_t *
 
#define cob_u8_ptr   cob_u8_t *
 
#define cob_s8_ptr   cob_s8_t *
 
#define cob_u16_ptr   cob_u16_t *
 
#define cob_s16_ptr   cob_s16_t *
 
#define cob_u32_ptr   cob_u32_t *
 
#define cob_s32_ptr   cob_s32_t *
 
#define cob_u64_ptr   cob_u64_t *
 
#define cob_s64_ptr   cob_s64_t *
 
#define cob_void_ptr   void *
 
#define cob_field_ptr   cob_field *
 
#define cob_file_ptr   cob_file *
 
#define cob_module_ptr   cob_module *
 
#define cob_screen_ptr   cob_screen *
 
#define cob_file_key_ptr   cob_file_key *
 
#define COB_BSWAP_16_CONSTANT(val)
 
#define COB_BSWAP_32_CONSTANT(val)
 
#define COB_BSWAP_64_CONSTANT(val)
 
#define COB_BSWAP_16(val)   (COB_BSWAP_16_CONSTANT (val))
 
#define COB_BSWAP_32(val)   (COB_BSWAP_32_CONSTANT (val))
 
#define COB_BSWAP_64(val)   (COB_BSWAP_64_CONSTANT (val))
 
#define COB_EXPIMP   extern
 
#define COB_INLINE   COB_KEYWORD_INLINE
 
#define COB_A_NORETURN
 
#define COB_A_FORMAT12
 
#define COB_A_FORMAT23
 
#define COB_A_FORMAT34
 
#define DECLNORET
 
#define optim_memcpy(x, y, z)   memcpy (x, y, z)
 
#define likely(x)   (x)
 
#define unlikely(x)   (x)
 
#define COB_A_MALLOC
 
#define COB_NOINLINE
 
#define COB_A_INLINE
 
#define COB_A_COLD
 
#define COB_NON_ALIGNED
 
#define __unaligned
 
#define PATHSEPC   ':'
 
#define PATHSEPS   ":"
 
#define SLASH_INT   '/'
 
#define SLASH_STR   "/"
 
#define COB_UNUSED(z)   do { (void)(z); } while (0)
 
#define COB_MINI_BUFF   256
 
#define COB_SMALL_BUFF   1024
 
#define COB_NORMAL_BUFF   2048
 
#define COB_FILE_BUFF   4096
 
#define COB_MEDIUM_BUFF   8192
 
#define COB_LARGE_BUFF   16384
 
#define COB_MINI_MAX   (COB_MINI_BUFF - 1)
 
#define COB_SMALL_MAX   (COB_SMALL_BUFF - 1)
 
#define COB_NORMAL_MAX   (COB_NORMAL_BUFF - 1)
 
#define COB_FILE_MAX   (COB_FILE_BUFF - 1)
 
#define COB_MEDIUM_MAX   (COB_MEDIUM_BUFF - 1)
 
#define COB_LARGE_MAX   (COB_LARGE_BUFF - 1)
 
#define COB_STACK_SIZE   255
 
#define MAX_FD_RECORD   65535
 
#define COB_MAX_FIELD_PARAMS   36
 
#define COB_MAX_DIGITS   38
 
#define COB_MAX_BINARY   39
 
#define COB_MAX_FIELD_SIZE   268435456
 
#define COB_MAX_DEC_STRUCT   32
 
#define COB_MAX_WORDLEN   61
 
#define COB_SORT_MEMORY   128 * 1024 * 1024
 
#define COB_SORT_CHUNK   256 * 1024
 
#define COB_RET_TYPE_INT   0
 
#define COB_RET_TYPE_PTR   1
 
#define COB_RET_TYPE_VOID   2
 
#define COB_FOLD_UPPER   1
 
#define COB_FOLD_LOWER   2
 
#define COB_LC_COLLATE   0
 
#define COB_LC_CTYPE   1
 
#define COB_LC_MESSAGES   2
 
#define COB_LC_MONETARY   3
 
#define COB_LC_NUMERIC   4
 
#define COB_LC_TIME   5
 
#define COB_LC_ALL   6
 
#define COB_LC_USER   7
 
#define COB_LC_CLASS   8
 
#define COB_TYPE_UNKNOWN   0x00
 
#define COB_TYPE_GROUP   0x01U
 
#define COB_TYPE_BOOLEAN   0x02U
 
#define COB_TYPE_NUMERIC   0x10U
 
#define COB_TYPE_NUMERIC_DISPLAY   0x10U
 
#define COB_TYPE_NUMERIC_BINARY   0x11U
 
#define COB_TYPE_NUMERIC_PACKED   0x12U
 
#define COB_TYPE_NUMERIC_FLOAT   0x13U
 
#define COB_TYPE_NUMERIC_DOUBLE   0x14U
 
#define COB_TYPE_NUMERIC_L_DOUBLE   0x15U
 
#define COB_TYPE_NUMERIC_FP_DEC64   0x16U
 
#define COB_TYPE_NUMERIC_FP_DEC128   0x17U
 
#define COB_TYPE_NUMERIC_FP_BIN32   0x18U
 
#define COB_TYPE_NUMERIC_FP_BIN64   0x19U
 
#define COB_TYPE_NUMERIC_FP_BIN128   0x1AU
 
#define COB_TYPE_NUMERIC_EDITED   0x24U
 
#define COB_TYPE_ALPHANUMERIC   0x21U
 
#define COB_TYPE_ALPHANUMERIC_ALL   0x22U
 
#define COB_TYPE_ALPHANUMERIC_EDITED   0x23U
 
#define COB_TYPE_NATIONAL   0x40U
 
#define COB_TYPE_NATIONAL_EDITED   0x41U
 
#define COB_FLAG_HAVE_SIGN   (1U << 0) /* 0x0001 */
 
#define COB_FLAG_SIGN_SEPARATE   (1U << 1) /* 0x0002 */
 
#define COB_FLAG_SIGN_LEADING   (1U << 2) /* 0x0004 */
 
#define COB_FLAG_BLANK_ZERO   (1U << 3) /* 0x0008 */
 
#define COB_FLAG_JUSTIFIED   (1U << 4) /* 0x0010 */
 
#define COB_FLAG_BINARY_SWAP   (1U << 5) /* 0x0020 */
 
#define COB_FLAG_REAL_BINARY   (1U << 6) /* 0x0040 */
 
#define COB_FLAG_IS_POINTER   (1U << 7) /* 0x0080 */
 
#define COB_FLAG_NO_SIGN_NIBBLE   (1U << 8) /* 0x0100 */
 
#define COB_FLAG_IS_FP   (1U << 9) /* 0x0200 */
 
#define COB_FLAG_REAL_SIGN   (1U << 10) /* 0x0400 */
 
#define COB_FLAG_BINARY_TRUNC   (1U << 11) /* 0x0800 */
 
#define COB_FIELD_HAVE_SIGN(f)   ((f)->attr->flags & COB_FLAG_HAVE_SIGN)
 
#define COB_FIELD_SIGN_SEPARATE(f)   ((f)->attr->flags & COB_FLAG_SIGN_SEPARATE)
 
#define COB_FIELD_SIGN_LEADING(f)   ((f)->attr->flags & COB_FLAG_SIGN_LEADING)
 
#define COB_FIELD_BLANK_ZERO(f)   ((f)->attr->flags & COB_FLAG_BLANK_ZERO)
 
#define COB_FIELD_JUSTIFIED(f)   ((f)->attr->flags & COB_FLAG_JUSTIFIED)
 
#define COB_FIELD_BINARY_SWAP(f)   ((f)->attr->flags & COB_FLAG_BINARY_SWAP)
 
#define COB_FIELD_REAL_BINARY(f)   ((f)->attr->flags & COB_FLAG_REAL_BINARY)
 
#define COB_FIELD_IS_POINTER(f)   ((f)->attr->flags & COB_FLAG_IS_POINTER)
 
#define COB_FIELD_NO_SIGN_NIBBLE(f)   ((f)->attr->flags & COB_FLAG_NO_SIGN_NIBBLE)
 
#define COB_FIELD_IS_FP(f)   ((f)->attr->flags & COB_FLAG_IS_FP)
 
#define COB_FIELD_REAL_SIGN(f)   ((f)->attr->flags & COB_FLAG_REAL_SIGN)
 
#define COB_FIELD_BINARY_TRUNC(f)   ((f)->attr->flags & COB_FLAG_BINARY_TRUNC)
 
#define COB_FLAG_LEADSEP   (COB_FLAG_SIGN_SEPARATE | COB_FLAG_SIGN_LEADING)
 
#define COB_FIELD_SIGN_LEADSEP(f)   (((f)->attr->flags & COB_FLAG_LEADSEP) == COB_FLAG_LEADSEP)
 
#define COB_FIELD_TYPE(f)   ((f)->attr->type)
 
#define COB_FIELD_DIGITS(f)   ((f)->attr->digits)
 
#define COB_FIELD_SCALE(f)   ((f)->attr->scale)
 
#define COB_FIELD_FLAGS(f)   ((f)->attr->flags)
 
#define COB_FIELD_PIC(f)   ((f)->attr->pic)
 
#define COB_FIELD_DATA(f)   ((f)->data + (COB_FIELD_SIGN_LEADSEP (f) ? 1 : 0))
 
#define COB_FIELD_SIZE(f)   (COB_FIELD_SIGN_SEPARATE (f) ? f->size - 1 : f->size)
 
#define COB_FIELD_IS_NUMERIC(f)   (COB_FIELD_TYPE (f) & COB_TYPE_NUMERIC)
 
#define COB_FIELD_IS_NUMDISP(f)   (COB_FIELD_TYPE (f) == COB_TYPE_NUMERIC_DISPLAY)
 
#define COB_FIELD_IS_ALNUM(f)   (COB_FIELD_TYPE (f) == COB_TYPE_ALPHANUMERIC)
 
#define COB_FIELD_IS_NATIONAL(f)   (COB_FIELD_TYPE (f) & COB_TYPE_NATIONAL)
 
#define COB_DISPLAY_SIGN_ASCII   0
 
#define COB_DISPLAY_SIGN_EBCDIC   1
 
#define COB_NATIONAL_SIZE   2
 
#define COB_SET_FLD(v, x, y, z)   (v.size = x, v.data = y, v.attr = z, &v)
 
#define COB_SET_DATA(x, z)   (x.data = z, &x)
 
#define COB_FERROR_NONE   0
 
#define COB_FERROR_CANCEL   1
 
#define COB_FERROR_INITIALIZED   2
 
#define COB_FERROR_CODEGEN   3
 
#define COB_FERROR_CHAINING   4
 
#define COB_FERROR_STACK   5
 
#define COB_FERROR_GLOBAL   6
 
#define COB_FERROR_MEMORY   7
 
#define COB_FERROR_MODULE   8
 
#define COB_FERROR_RECURSIVE   9
 
#define COB_FERROR_SCR_INP   10
 
#define COB_FERROR_FILE   11
 
#define COB_FERROR_FUNCTION   12
 
#define COB_FERROR_FREE   13
 
#define COB_EXCEPTION(code, tag, name, critical)   tag,
 
#define COB_FILE_VERSION   1
 
#define COB_EQ   1 /* x == y */
 
#define COB_LT   2 /* x < y */
 
#define COB_LE   3 /* x <= y */
 
#define COB_GT   4 /* x > y */
 
#define COB_GE   5 /* x >= y */
 
#define COB_NE   6 /* x != y */
 
#define COB_FI   7 /* First */
 
#define COB_LA   8 /* Last */
 
#define COB_ASCENDING   0
 
#define COB_DESCENDING   1
 
#define COB_FILE_MODE   0644
 
#define COB_ORG_SEQUENTIAL   0
 
#define COB_ORG_LINE_SEQUENTIAL   1
 
#define COB_ORG_RELATIVE   2
 
#define COB_ORG_INDEXED   3
 
#define COB_ORG_SORT   4
 
#define COB_ORG_MAX   5
 
#define COB_ACCESS_SEQUENTIAL   1
 
#define COB_ACCESS_DYNAMIC   2
 
#define COB_ACCESS_RANDOM   3
 
#define COB_SELECT_FILE_STATUS   (1U << 0)
 
#define COB_SELECT_EXTERNAL   (1U << 1)
 
#define COB_SELECT_LINAGE   (1U << 2)
 
#define COB_SELECT_SPLITKEY   (1U << 3)
 
#define COB_SELECT_STDIN   (1U << 4)
 
#define COB_SELECT_STDOUT   (1U << 5)
 
#define COB_SELECT_TEMPORARY   (1U << 6)
 
#define COB_FILE_SPECIAL(x)   ((x)->flag_select_features & (COB_SELECT_STDIN | COB_SELECT_STDOUT))
 
#define COB_FILE_STDIN(x)   ((x)->flag_select_features & COB_SELECT_STDIN)
 
#define COB_FILE_STDOUT(x)   ((x)->flag_select_features & COB_SELECT_STDOUT)
 
#define COB_FILE_TEMPORARY(x)   ((x)->flag_select_features & COB_SELECT_TEMPORARY)
 
#define COB_LOCK_EXCLUSIVE   (1U << 0)
 
#define COB_LOCK_MANUAL   (1U << 1)
 
#define COB_LOCK_AUTOMATIC   (1U << 2)
 
#define COB_LOCK_MULTIPLE   (1U << 3)
 
#define COB_LOCK_OPEN_EXCLUSIVE   (1U << 4)
 
#define COB_FILE_EXCLUSIVE   (COB_LOCK_EXCLUSIVE | COB_LOCK_OPEN_EXCLUSIVE)
 
#define COB_OPEN_CLOSED   0
 
#define COB_OPEN_INPUT   1
 
#define COB_OPEN_OUTPUT   2
 
#define COB_OPEN_I_O   3
 
#define COB_OPEN_EXTEND   4
 
#define COB_OPEN_LOCKED   5
 
#define COB_CLOSE_NORMAL   0
 
#define COB_CLOSE_LOCK   1
 
#define COB_CLOSE_NO_REWIND   2
 
#define COB_CLOSE_UNIT   3
 
#define COB_CLOSE_UNIT_REMOVAL   4
 
#define COB_WRITE_MASK   0x0000FFFF
 
#define COB_WRITE_LINES   0x00010000
 
#define COB_WRITE_PAGE   0x00020000
 
#define COB_WRITE_CHANNEL   0x00040000
 
#define COB_WRITE_AFTER   0x00100000
 
#define COB_WRITE_BEFORE   0x00200000
 
#define COB_WRITE_EOP   0x00400000
 
#define COB_WRITE_LOCK   0x00800000
 
#define COB_WRITE_NO_LOCK   0x01000000
 
#define COB_READ_NEXT   (1 << 0)
 
#define COB_READ_PREVIOUS   (1 << 1)
 
#define COB_READ_FIRST   (1 << 2)
 
#define COB_READ_LAST   (1 << 3)
 
#define COB_READ_LOCK   (1 << 4)
 
#define COB_READ_NO_LOCK   (1 << 5)
 
#define COB_READ_KEPT_LOCK   (1 << 6)
 
#define COB_READ_WAIT_LOCK   (1 << 7)
 
#define COB_READ_IGNORE_LOCK   (1 << 8)
 
#define COB_READ_MASK   (COB_READ_NEXT | COB_READ_PREVIOUS | COB_READ_FIRST | COB_READ_LAST)
 
#define COB_STATUS_00_SUCCESS   00
 
#define COB_STATUS_02_SUCCESS_DUPLICATE   02
 
#define COB_STATUS_04_SUCCESS_INCOMPLETE   04
 
#define COB_STATUS_05_SUCCESS_OPTIONAL   05
 
#define COB_STATUS_07_SUCCESS_NO_UNIT   07
 
#define COB_STATUS_10_END_OF_FILE   10
 
#define COB_STATUS_14_OUT_OF_KEY_RANGE   14
 
#define COB_STATUS_21_KEY_INVALID   21
 
#define COB_STATUS_22_KEY_EXISTS   22
 
#define COB_STATUS_23_KEY_NOT_EXISTS   23
 
#define COB_STATUS_24_KEY_BOUNDARY   24
 
#define COB_STATUS_30_PERMANENT_ERROR   30
 
#define COB_STATUS_31_INCONSISTENT_FILENAME   31
 
#define COB_STATUS_34_BOUNDARY_VIOLATION   34
 
#define COB_STATUS_35_NOT_EXISTS   35
 
#define COB_STATUS_37_PERMISSION_DENIED   37
 
#define COB_STATUS_38_CLOSED_WITH_LOCK   38
 
#define COB_STATUS_39_CONFLICT_ATTRIBUTE   39
 
#define COB_STATUS_41_ALREADY_OPEN   41
 
#define COB_STATUS_42_NOT_OPEN   42
 
#define COB_STATUS_43_READ_NOT_DONE   43
 
#define COB_STATUS_44_RECORD_OVERFLOW   44
 
#define COB_STATUS_46_READ_ERROR   46
 
#define COB_STATUS_47_INPUT_DENIED   47
 
#define COB_STATUS_48_OUTPUT_DENIED   48
 
#define COB_STATUS_49_I_O_DENIED   49
 
#define COB_STATUS_51_RECORD_LOCKED   51
 
#define COB_STATUS_57_I_O_LINAGE   57
 
#define COB_STATUS_61_FILE_SHARING   61
 
#define COB_STATUS_91_NOT_AVAILABLE   91
 
#define COB_NOT_CONFIGURED   32768
 
#define COB_STORE_ROUND   (1 << 0)
 
#define COB_STORE_KEEP_ON_OVERFLOW   (1 << 1)
 
#define COB_STORE_TRUNC_ON_OVERFLOW   (1 << 2)
 
#define COB_STORE_AWAY_FROM_ZERO   (1 << 4)
 
#define COB_STORE_NEAR_AWAY_FROM_ZERO   (1 << 5)
 
#define COB_STORE_NEAR_EVEN   (1 << 6)
 
#define COB_STORE_NEAR_TOWARD_ZERO   (1 << 7)
 
#define COB_STORE_PROHIBITED   (1 << 8)
 
#define COB_STORE_TOWARD_GREATER   (1 << 9)
 
#define COB_STORE_TOWARD_LESSER   (1 << 10)
 
#define COB_STORE_TRUNCATION   (1 << 11)
 
#define COB_STORE_MASK
 
#define COB_SCREEN_BLACK   0
 
#define COB_SCREEN_BLUE   1
 
#define COB_SCREEN_GREEN   2
 
#define COB_SCREEN_CYAN   3
 
#define COB_SCREEN_RED   4
 
#define COB_SCREEN_MAGENTA   5
 
#define COB_SCREEN_YELLOW   6
 
#define COB_SCREEN_WHITE   7
 
#define COB_SCREEN_LINE_PLUS   (1 << 0)
 
#define COB_SCREEN_LINE_MINUS   (1 << 1)
 
#define COB_SCREEN_COLUMN_PLUS   (1 << 2)
 
#define COB_SCREEN_COLUMN_MINUS   (1 << 3)
 
#define COB_SCREEN_AUTO   (1 << 4)
 
#define COB_SCREEN_BELL   (1 << 5)
 
#define COB_SCREEN_BLANK_LINE   (1 << 6)
 
#define COB_SCREEN_BLANK_SCREEN   (1 << 7)
 
#define COB_SCREEN_BLINK   (1 << 8)
 
#define COB_SCREEN_ERASE_EOL   (1 << 9)
 
#define COB_SCREEN_ERASE_EOS   (1 << 10)
 
#define COB_SCREEN_FULL   (1 << 11)
 
#define COB_SCREEN_HIGHLIGHT   (1 << 12)
 
#define COB_SCREEN_LOWLIGHT   (1 << 13)
 
#define COB_SCREEN_REQUIRED   (1 << 14)
 
#define COB_SCREEN_REVERSE   (1 << 15)
 
#define COB_SCREEN_SECURE   (1 << 16)
 
#define COB_SCREEN_UNDERLINE   (1 << 17)
 
#define COB_SCREEN_OVERLINE   (1 << 18)
 
#define COB_SCREEN_PROMPT   (1 << 19)
 
#define COB_SCREEN_UPDATE   (1 << 20)
 
#define COB_SCREEN_INPUT   (1 << 21)
 
#define COB_SCREEN_SCROLL_DOWN   (1 << 22)
 
#define COB_SCREEN_INITIAL   (1 << 23)
 
#define COB_SCREEN_NO_ECHO   (1 << 24)
 
#define COB_SCREEN_LEFTLINE   (1 << 25)
 
#define COB_SCREEN_NO_DISP   (1 << 26)
 
#define COB_SCREEN_EMULATE_NL   (1 << 27)
 
#define COB_SCREEN_UPPER   (1 << 28)
 
#define COB_SCREEN_LOWER   (1 << 29)
 
#define COB_SCREEN_TYPE_GROUP   0
 
#define COB_SCREEN_TYPE_FIELD   1
 
#define COB_SCREEN_TYPE_VALUE   2
 
#define COB_SCREEN_TYPE_ATTRIBUTE   3
 
#define cobgetenv(x)   cob_getenv (x)
 
#define cobputenv(x)   cob_putenv (x)
 
#define cobtidy()   cob_tidy ()
 
#define cobinit()   cob_extern_init ()
 
#define cobexit(x)   cob_stop_run (x)
 
#define cobcommandline(v, w, x, y, z)   cob_command_line (v,w,x,y,z)
 
#define cobsetjmp(x)   setjmp (cob_savenv (x))
 
#define coblongjmp(x)   cob_longjmp (x)
 
#define cobsavenv(x)   cob_savenv (x)
 
#define cobsavenv2(x, z)   cob_savenv2 (x, z)
 
#define cobfunc(x, y, z)   cob_func (x, y, z)
 
#define cobcall(x, y, z)   cob_call (x, y, z)
 
#define cobcancel(x)   cob_cancel (x)
 
#define cob_c8_t   char
 
#define cob_s8_t   signed char
 
#define cob_u8_t   unsigned char
 
#define cob_s16_t   short
 
#define cob_u16_t   unsigned short
 
#define cob_s32_t   int
 
#define cob_u32_t   unsigned int
 
#define cob_sli_t   long int
 
#define cob_uli_t   unsigned long int
 
#define cob_s64_t   long long
 
#define cob_u64_t   unsigned long long
 
#define COB_S64_C(x)   x ## LL
 
#define COB_U64_C(x)   x ## ULL
 
#define CB_FMT_LLD   "%lld"
 
#define CB_FMT_LLU   "%llu"
 
#define CB_FMT_PLLD   "%+*.*lld"
 
#define CB_FMT_PLLU   "%*.*llu"
 
#define CB_FMT_LLD_F   "%lldLL"
 
#define CB_FMT_LLU_F   "%lluULL"
 
#define cob_c8_ptr   cob_c8_t *
 
#define cob_u8_ptr   cob_u8_t *
 
#define cob_s8_ptr   cob_s8_t *
 
#define cob_u16_ptr   cob_u16_t *
 
#define cob_s16_ptr   cob_s16_t *
 
#define cob_u32_ptr   cob_u32_t *
 
#define cob_s32_ptr   cob_s32_t *
 
#define cob_u64_ptr   cob_u64_t *
 
#define cob_s64_ptr   cob_s64_t *
 
#define cob_void_ptr   void *
 
#define cob_field_ptr   cob_field *
 
#define cob_file_ptr   cob_file *
 
#define cob_module_ptr   cob_module *
 
#define cob_screen_ptr   cob_screen *
 
#define cob_file_key_ptr   cob_file_key *
 
#define COB_BSWAP_16_CONSTANT(val)
 
#define COB_BSWAP_32_CONSTANT(val)
 
#define COB_BSWAP_64_CONSTANT(val)
 
#define COB_BSWAP_16(val)   (COB_BSWAP_16_CONSTANT (val))
 
#define COB_BSWAP_32(val)   (COB_BSWAP_32_CONSTANT (val))
 
#define COB_BSWAP_64(val)   (COB_BSWAP_64_CONSTANT (val))
 
#define COB_EXPIMP   extern
 
#define COB_INLINE
 
#define COB_A_NORETURN
 
#define COB_A_FORMAT12
 
#define COB_A_FORMAT23
 
#define COB_A_FORMAT34
 
#define DECLNORET
 
#define optim_memcpy(x, y, z)   memcpy (x, y, z)
 
#define likely(x)   (x)
 
#define unlikely(x)   (x)
 
#define COB_A_MALLOC
 
#define COB_NOINLINE
 
#define COB_A_INLINE
 
#define COB_A_COLD
 
#define COB_NON_ALIGNED
 
#define __unaligned
 
#define PATHSEPC   ':'
 
#define PATHSEPS   ":"
 
#define SLASH_INT   '/'
 
#define SLASH_STR   "/"
 
#define COB_UNUSED(z)   do { (void)(z); } while (0)
 
#define COB_MINI_BUFF   256
 
#define COB_SMALL_BUFF   1024
 
#define COB_NORMAL_BUFF   2048
 
#define COB_FILE_BUFF   4096
 
#define COB_MEDIUM_BUFF   8192
 
#define COB_LARGE_BUFF   16384
 
#define COB_MINI_MAX   (COB_MINI_BUFF - 1)
 
#define COB_SMALL_MAX   (COB_SMALL_BUFF - 1)
 
#define COB_NORMAL_MAX   (COB_NORMAL_BUFF - 1)
 
#define COB_FILE_MAX   (COB_FILE_BUFF - 1)
 
#define COB_MEDIUM_MAX   (COB_MEDIUM_BUFF - 1)
 
#define COB_LARGE_MAX   (COB_LARGE_BUFF - 1)
 
#define COB_STACK_SIZE   255
 
#define MAX_FD_RECORD   65535
 
#define COB_MAX_FIELD_PARAMS   36
 
#define COB_MAX_DIGITS   38
 
#define COB_MAX_BINARY   39
 
#define COB_MAX_FIELD_SIZE   268435456
 
#define COB_MAX_DEC_STRUCT   32
 
#define COB_MAX_WORDLEN   61
 
#define COB_SORT_MEMORY   128 * 1024 * 1024
 
#define COB_SORT_CHUNK   256 * 1024
 
#define COB_RET_TYPE_INT   0
 
#define COB_RET_TYPE_PTR   1
 
#define COB_RET_TYPE_VOID   2
 
#define COB_FOLD_UPPER   1
 
#define COB_FOLD_LOWER   2
 
#define COB_LC_COLLATE   0
 
#define COB_LC_CTYPE   1
 
#define COB_LC_MESSAGES   2
 
#define COB_LC_MONETARY   3
 
#define COB_LC_NUMERIC   4
 
#define COB_LC_TIME   5
 
#define COB_LC_ALL   6
 
#define COB_LC_USER   7
 
#define COB_LC_CLASS   8
 
#define COB_TYPE_UNKNOWN   0x00
 
#define COB_TYPE_GROUP   0x01U
 
#define COB_TYPE_BOOLEAN   0x02U
 
#define COB_TYPE_NUMERIC   0x10U
 
#define COB_TYPE_NUMERIC_DISPLAY   0x10U
 
#define COB_TYPE_NUMERIC_BINARY   0x11U
 
#define COB_TYPE_NUMERIC_PACKED   0x12U
 
#define COB_TYPE_NUMERIC_FLOAT   0x13U
 
#define COB_TYPE_NUMERIC_DOUBLE   0x14U
 
#define COB_TYPE_NUMERIC_L_DOUBLE   0x15U
 
#define COB_TYPE_NUMERIC_FP_DEC64   0x16U
 
#define COB_TYPE_NUMERIC_FP_DEC128   0x17U
 
#define COB_TYPE_NUMERIC_FP_BIN32   0x18U
 
#define COB_TYPE_NUMERIC_FP_BIN64   0x19U
 
#define COB_TYPE_NUMERIC_FP_BIN128   0x1AU
 
#define COB_TYPE_NUMERIC_EDITED   0x24U
 
#define COB_TYPE_ALPHANUMERIC   0x21U
 
#define COB_TYPE_ALPHANUMERIC_ALL   0x22U
 
#define COB_TYPE_ALPHANUMERIC_EDITED   0x23U
 
#define COB_TYPE_NATIONAL   0x40U
 
#define COB_TYPE_NATIONAL_EDITED   0x41U
 
#define COB_FLAG_HAVE_SIGN   (1U << 0) /* 0x0001 */
 
#define COB_FLAG_SIGN_SEPARATE   (1U << 1) /* 0x0002 */
 
#define COB_FLAG_SIGN_LEADING   (1U << 2) /* 0x0004 */
 
#define COB_FLAG_BLANK_ZERO   (1U << 3) /* 0x0008 */
 
#define COB_FLAG_JUSTIFIED   (1U << 4) /* 0x0010 */
 
#define COB_FLAG_BINARY_SWAP   (1U << 5) /* 0x0020 */
 
#define COB_FLAG_REAL_BINARY   (1U << 6) /* 0x0040 */
 
#define COB_FLAG_IS_POINTER   (1U << 7) /* 0x0080 */
 
#define COB_FLAG_NO_SIGN_NIBBLE   (1U << 8) /* 0x0100 */
 
#define COB_FLAG_IS_FP   (1U << 9) /* 0x0200 */
 
#define COB_FLAG_REAL_SIGN   (1U << 10) /* 0x0400 */
 
#define COB_FLAG_BINARY_TRUNC   (1U << 11) /* 0x0800 */
 
#define COB_FIELD_HAVE_SIGN(f)   ((f)->attr->flags & COB_FLAG_HAVE_SIGN)
 
#define COB_FIELD_SIGN_SEPARATE(f)   ((f)->attr->flags & COB_FLAG_SIGN_SEPARATE)
 
#define COB_FIELD_SIGN_LEADING(f)   ((f)->attr->flags & COB_FLAG_SIGN_LEADING)
 
#define COB_FIELD_BLANK_ZERO(f)   ((f)->attr->flags & COB_FLAG_BLANK_ZERO)
 
#define COB_FIELD_JUSTIFIED(f)   ((f)->attr->flags & COB_FLAG_JUSTIFIED)
 
#define COB_FIELD_BINARY_SWAP(f)   ((f)->attr->flags & COB_FLAG_BINARY_SWAP)
 
#define COB_FIELD_REAL_BINARY(f)   ((f)->attr->flags & COB_FLAG_REAL_BINARY)
 
#define COB_FIELD_IS_POINTER(f)   ((f)->attr->flags & COB_FLAG_IS_POINTER)
 
#define COB_FIELD_NO_SIGN_NIBBLE(f)   ((f)->attr->flags & COB_FLAG_NO_SIGN_NIBBLE)
 
#define COB_FIELD_IS_FP(f)   ((f)->attr->flags & COB_FLAG_IS_FP)
 
#define COB_FIELD_REAL_SIGN(f)   ((f)->attr->flags & COB_FLAG_REAL_SIGN)
 
#define COB_FIELD_BINARY_TRUNC(f)   ((f)->attr->flags & COB_FLAG_BINARY_TRUNC)
 
#define COB_FLAG_LEADSEP   (COB_FLAG_SIGN_SEPARATE | COB_FLAG_SIGN_LEADING)
 
#define COB_FIELD_SIGN_LEADSEP(f)   (((f)->attr->flags & COB_FLAG_LEADSEP) == COB_FLAG_LEADSEP)
 
#define COB_FIELD_TYPE(f)   ((f)->attr->type)
 
#define COB_FIELD_DIGITS(f)   ((f)->attr->digits)
 
#define COB_FIELD_SCALE(f)   ((f)->attr->scale)
 
#define COB_FIELD_FLAGS(f)   ((f)->attr->flags)
 
#define COB_FIELD_PIC(f)   ((f)->attr->pic)
 
#define COB_FIELD_DATA(f)   ((f)->data + (COB_FIELD_SIGN_LEADSEP (f) ? 1 : 0))
 
#define COB_FIELD_SIZE(f)   (COB_FIELD_SIGN_SEPARATE (f) ? f->size - 1 : f->size)
 
#define COB_FIELD_IS_NUMERIC(f)   (COB_FIELD_TYPE (f) & COB_TYPE_NUMERIC)
 
#define COB_FIELD_IS_NUMDISP(f)   (COB_FIELD_TYPE (f) == COB_TYPE_NUMERIC_DISPLAY)
 
#define COB_FIELD_IS_ALNUM(f)   (COB_FIELD_TYPE (f) == COB_TYPE_ALPHANUMERIC)
 
#define COB_FIELD_IS_NATIONAL(f)   (COB_FIELD_TYPE (f) & COB_TYPE_NATIONAL)
 
#define COB_DISPLAY_SIGN_ASCII   0
 
#define COB_DISPLAY_SIGN_EBCDIC   1
 
#define COB_NATIONAL_SIZE   2
 
#define COB_SET_FLD(v, x, y, z)   (v.size = x, v.data = y, v.attr = z, &v)
 
#define COB_SET_DATA(x, z)   (x.data = z, &x)
 
#define COB_FERROR_NONE   0
 
#define COB_FERROR_CANCEL   1
 
#define COB_FERROR_INITIALIZED   2
 
#define COB_FERROR_CODEGEN   3
 
#define COB_FERROR_CHAINING   4
 
#define COB_FERROR_STACK   5
 
#define COB_FERROR_GLOBAL   6
 
#define COB_FERROR_MEMORY   7
 
#define COB_FERROR_MODULE   8
 
#define COB_FERROR_RECURSIVE   9
 
#define COB_FERROR_SCR_INP   10
 
#define COB_FERROR_FILE   11
 
#define COB_FERROR_FUNCTION   12
 
#define COB_FERROR_FREE   13
 
#define COB_EXCEPTION(code, tag, name, critical)   tag,
 
#define COB_FILE_VERSION   1
 
#define COB_EQ   1 /* x == y */
 
#define COB_LT   2 /* x < y */
 
#define COB_LE   3 /* x <= y */
 
#define COB_GT   4 /* x > y */
 
#define COB_GE   5 /* x >= y */
 
#define COB_NE   6 /* x != y */
 
#define COB_FI   7 /* First */
 
#define COB_LA   8 /* Last */
 
#define COB_ASCENDING   0
 
#define COB_DESCENDING   1
 
#define COB_FILE_MODE   0644
 
#define COB_ORG_SEQUENTIAL   0
 
#define COB_ORG_LINE_SEQUENTIAL   1
 
#define COB_ORG_RELATIVE   2
 
#define COB_ORG_INDEXED   3
 
#define COB_ORG_SORT   4
 
#define COB_ORG_MAX   5
 
#define COB_ACCESS_SEQUENTIAL   1
 
#define COB_ACCESS_DYNAMIC   2
 
#define COB_ACCESS_RANDOM   3
 
#define COB_SELECT_FILE_STATUS   (1U << 0)
 
#define COB_SELECT_EXTERNAL   (1U << 1)
 
#define COB_SELECT_LINAGE   (1U << 2)
 
#define COB_SELECT_SPLITKEY   (1U << 3)
 
#define COB_SELECT_STDIN   (1U << 4)
 
#define COB_SELECT_STDOUT   (1U << 5)
 
#define COB_SELECT_TEMPORARY   (1U << 6)
 
#define COB_FILE_SPECIAL(x)   ((x)->flag_select_features & (COB_SELECT_STDIN | COB_SELECT_STDOUT))
 
#define COB_FILE_STDIN(x)   ((x)->flag_select_features & COB_SELECT_STDIN)
 
#define COB_FILE_STDOUT(x)   ((x)->flag_select_features & COB_SELECT_STDOUT)
 
#define COB_FILE_TEMPORARY(x)   ((x)->flag_select_features & COB_SELECT_TEMPORARY)
 
#define COB_LOCK_EXCLUSIVE   (1U << 0)
 
#define COB_LOCK_MANUAL   (1U << 1)
 
#define COB_LOCK_AUTOMATIC   (1U << 2)
 
#define COB_LOCK_MULTIPLE   (1U << 3)
 
#define COB_LOCK_OPEN_EXCLUSIVE   (1U << 4)
 
#define COB_FILE_EXCLUSIVE   (COB_LOCK_EXCLUSIVE | COB_LOCK_OPEN_EXCLUSIVE)
 
#define COB_OPEN_CLOSED   0
 
#define COB_OPEN_INPUT   1
 
#define COB_OPEN_OUTPUT   2
 
#define COB_OPEN_I_O   3
 
#define COB_OPEN_EXTEND   4
 
#define COB_OPEN_LOCKED   5
 
#define COB_CLOSE_NORMAL   0
 
#define COB_CLOSE_LOCK   1
 
#define COB_CLOSE_NO_REWIND   2
 
#define COB_CLOSE_UNIT   3
 
#define COB_CLOSE_UNIT_REMOVAL   4
 
#define COB_WRITE_MASK   0x0000FFFF
 
#define COB_WRITE_LINES   0x00010000
 
#define COB_WRITE_PAGE   0x00020000
 
#define COB_WRITE_CHANNEL   0x00040000
 
#define COB_WRITE_AFTER   0x00100000
 
#define COB_WRITE_BEFORE   0x00200000
 
#define COB_WRITE_EOP   0x00400000
 
#define COB_WRITE_LOCK   0x00800000
 
#define COB_WRITE_NO_LOCK   0x01000000
 
#define COB_READ_NEXT   (1 << 0)
 
#define COB_READ_PREVIOUS   (1 << 1)
 
#define COB_READ_FIRST   (1 << 2)
 
#define COB_READ_LAST   (1 << 3)
 
#define COB_READ_LOCK   (1 << 4)
 
#define COB_READ_NO_LOCK   (1 << 5)
 
#define COB_READ_KEPT_LOCK   (1 << 6)
 
#define COB_READ_WAIT_LOCK   (1 << 7)
 
#define COB_READ_IGNORE_LOCK   (1 << 8)
 
#define COB_READ_MASK   (COB_READ_NEXT | COB_READ_PREVIOUS | COB_READ_FIRST | COB_READ_LAST)
 
#define COB_STATUS_00_SUCCESS   00
 
#define COB_STATUS_02_SUCCESS_DUPLICATE   02
 
#define COB_STATUS_04_SUCCESS_INCOMPLETE   04
 
#define COB_STATUS_05_SUCCESS_OPTIONAL   05
 
#define COB_STATUS_07_SUCCESS_NO_UNIT   07
 
#define COB_STATUS_10_END_OF_FILE   10
 
#define COB_STATUS_14_OUT_OF_KEY_RANGE   14
 
#define COB_STATUS_21_KEY_INVALID   21
 
#define COB_STATUS_22_KEY_EXISTS   22
 
#define COB_STATUS_23_KEY_NOT_EXISTS   23
 
#define COB_STATUS_24_KEY_BOUNDARY   24
 
#define COB_STATUS_30_PERMANENT_ERROR   30
 
#define COB_STATUS_31_INCONSISTENT_FILENAME   31
 
#define COB_STATUS_34_BOUNDARY_VIOLATION   34
 
#define COB_STATUS_35_NOT_EXISTS   35
 
#define COB_STATUS_37_PERMISSION_DENIED   37
 
#define COB_STATUS_38_CLOSED_WITH_LOCK   38
 
#define COB_STATUS_39_CONFLICT_ATTRIBUTE   39
 
#define COB_STATUS_41_ALREADY_OPEN   41
 
#define COB_STATUS_42_NOT_OPEN   42
 
#define COB_STATUS_43_READ_NOT_DONE   43
 
#define COB_STATUS_44_RECORD_OVERFLOW   44
 
#define COB_STATUS_46_READ_ERROR   46
 
#define COB_STATUS_47_INPUT_DENIED   47
 
#define COB_STATUS_48_OUTPUT_DENIED   48
 
#define COB_STATUS_49_I_O_DENIED   49
 
#define COB_STATUS_51_RECORD_LOCKED   51
 
#define COB_STATUS_57_I_O_LINAGE   57
 
#define COB_STATUS_61_FILE_SHARING   61
 
#define COB_STATUS_91_NOT_AVAILABLE   91
 
#define COB_NOT_CONFIGURED   32768
 
#define COB_STORE_ROUND   (1 << 0)
 
#define COB_STORE_KEEP_ON_OVERFLOW   (1 << 1)
 
#define COB_STORE_TRUNC_ON_OVERFLOW   (1 << 2)
 
#define COB_STORE_AWAY_FROM_ZERO   (1 << 4)
 
#define COB_STORE_NEAR_AWAY_FROM_ZERO   (1 << 5)
 
#define COB_STORE_NEAR_EVEN   (1 << 6)
 
#define COB_STORE_NEAR_TOWARD_ZERO   (1 << 7)
 
#define COB_STORE_PROHIBITED   (1 << 8)
 
#define COB_STORE_TOWARD_GREATER   (1 << 9)
 
#define COB_STORE_TOWARD_LESSER   (1 << 10)
 
#define COB_STORE_TRUNCATION   (1 << 11)
 
#define COB_STORE_MASK
 
#define COB_SCREEN_BLACK   0
 
#define COB_SCREEN_BLUE   1
 
#define COB_SCREEN_GREEN   2
 
#define COB_SCREEN_CYAN   3
 
#define COB_SCREEN_RED   4
 
#define COB_SCREEN_MAGENTA   5
 
#define COB_SCREEN_YELLOW   6
 
#define COB_SCREEN_WHITE   7
 
#define COB_SCREEN_LINE_PLUS   (1 << 0)
 
#define COB_SCREEN_LINE_MINUS   (1 << 1)
 
#define COB_SCREEN_COLUMN_PLUS   (1 << 2)
 
#define COB_SCREEN_COLUMN_MINUS   (1 << 3)
 
#define COB_SCREEN_AUTO   (1 << 4)
 
#define COB_SCREEN_BELL   (1 << 5)
 
#define COB_SCREEN_BLANK_LINE   (1 << 6)
 
#define COB_SCREEN_BLANK_SCREEN   (1 << 7)
 
#define COB_SCREEN_BLINK   (1 << 8)
 
#define COB_SCREEN_ERASE_EOL   (1 << 9)
 
#define COB_SCREEN_ERASE_EOS   (1 << 10)
 
#define COB_SCREEN_FULL   (1 << 11)
 
#define COB_SCREEN_HIGHLIGHT   (1 << 12)
 
#define COB_SCREEN_LOWLIGHT   (1 << 13)
 
#define COB_SCREEN_REQUIRED   (1 << 14)
 
#define COB_SCREEN_REVERSE   (1 << 15)
 
#define COB_SCREEN_SECURE   (1 << 16)
 
#define COB_SCREEN_UNDERLINE   (1 << 17)
 
#define COB_SCREEN_OVERLINE   (1 << 18)
 
#define COB_SCREEN_PROMPT   (1 << 19)
 
#define COB_SCREEN_UPDATE   (1 << 20)
 
#define COB_SCREEN_INPUT   (1 << 21)
 
#define COB_SCREEN_SCROLL_DOWN   (1 << 22)
 
#define COB_SCREEN_INITIAL   (1 << 23)
 
#define COB_SCREEN_NO_ECHO   (1 << 24)
 
#define COB_SCREEN_LEFTLINE   (1 << 25)
 
#define COB_SCREEN_NO_DISP   (1 << 26)
 
#define COB_SCREEN_EMULATE_NL   (1 << 27)
 
#define COB_SCREEN_UPPER   (1 << 28)
 
#define COB_SCREEN_LOWER   (1 << 29)
 
#define COB_SCREEN_TYPE_GROUP   0
 
#define COB_SCREEN_TYPE_FIELD   1
 
#define COB_SCREEN_TYPE_VALUE   2
 
#define COB_SCREEN_TYPE_ATTRIBUTE   3
 
#define cobgetenv(x)   cob_getenv (x)
 
#define cobputenv(x)   cob_putenv (x)
 
#define cobtidy()   cob_tidy ()
 
#define cobinit()   cob_extern_init ()
 
#define cobexit(x)   cob_stop_run (x)
 
#define cobcommandline(v, w, x, y, z)   cob_command_line (v,w,x,y,z)
 
#define cobsetjmp(x)   setjmp (cob_savenv (x))
 
#define coblongjmp(x)   cob_longjmp (x)
 
#define cobsavenv(x)   cob_savenv (x)
 
#define cobsavenv2(x, z)   cob_savenv2 (x, z)
 
#define cobfunc(x, y, z)   cob_func (x, y, z)
 
#define cobcall(x, y, z)   cob_call (x, y, z)
 
#define cobcancel(x)   cob_cancel (x)
 

Typedefs

typedef struct __cob_screen cob_screen
 
typedef struct __cob_module cob_module
 
typedef struct __cob_global cob_global
 
typedef struct longoption_def longoption_def
 

Enumerations

enum  cob_exception_id { COB_EC_ZERO = 0, COB_EXCEPTION }
 

Functions

COB_EXPIMP void print_runtime_env (void)
 
COB_EXPIMP void print_info (void)
 
COB_EXPIMP void print_version (void)
 
char * cob_int_to_string (int, char *)
 
char * cob_int_to_formatted_bytestring (int, char *)
 
char * cob_strcat (char *, char *)
 
char * cob_strjoin (char **, int, char *)
 
COB_EXPIMP cob_globalcob_get_global_ptr (void)
 
COB_EXPIMP void cob_init (const int, char **)
 
COB_EXPIMP void cob_module_enter (cob_module **, cob_global **, const int)
 
COB_EXPIMP void cob_module_leave (cob_module *)
 
DECLNORET COB_EXPIMP void cob_stop_run (const int) COB_A_NORETURN
 
DECLNORET COB_EXPIMP void cob_fatal_error (const int) COB_A_NORETURN
 
COB_EXPIMP void * cob_malloc (const size_t) COB_A_MALLOC
 
COB_EXPIMP void cob_free (void *)
 
COB_EXPIMP void * cob_fast_malloc (const size_t) COB_A_MALLOC
 
COB_EXPIMP void * cob_cache_malloc (const size_t) COB_A_MALLOC
 
COB_EXPIMP void * cob_cache_realloc (void *, const size_t)
 
COB_EXPIMP void cob_cache_free (void *)
 
COB_EXPIMP void cob_set_locale (cob_field *, const int)
 
COB_EXPIMP void cob_check_version (const char *, const char *, const int)
 
COB_EXPIMP void * cob_save_func (cob_field **, const int, const int,...)
 
COB_EXPIMP void cob_restore_func (struct cob_func_loc *)
 
COB_EXPIMP void cob_accept_arg_number (cob_field *)
 
COB_EXPIMP void cob_accept_arg_value (cob_field *)
 
COB_EXPIMP void cob_accept_command_line (cob_field *)
 
COB_EXPIMP void cob_accept_date (cob_field *)
 
COB_EXPIMP void cob_accept_date_yyyymmdd (cob_field *)
 
COB_EXPIMP void cob_accept_day (cob_field *)
 
COB_EXPIMP void cob_accept_day_yyyyddd (cob_field *)
 
COB_EXPIMP void cob_accept_day_of_week (cob_field *)
 
COB_EXPIMP void cob_accept_environment (cob_field *)
 
COB_EXPIMP void cob_accept_exception_status (cob_field *)
 
COB_EXPIMP void cob_accept_time (cob_field *)
 
COB_EXPIMP void cob_accept_user_name (cob_field *)
 
COB_EXPIMP void cob_display_command_line (cob_field *)
 
COB_EXPIMP void cob_display_environment (const cob_field *)
 
COB_EXPIMP void cob_display_env_value (const cob_field *)
 
COB_EXPIMP void cob_display_arg_number (cob_field *)
 
COB_EXPIMP void cob_get_environment (const cob_field *, cob_field *)
 
COB_EXPIMP void cob_set_environment (const cob_field *, const cob_field *)
 
COB_EXPIMP void cob_chain_setup (void *, const size_t, const size_t)
 
COB_EXPIMP void cob_allocate (unsigned char **, cob_field *, cob_field *, cob_field *)
 
COB_EXPIMP void cob_free_alloc (unsigned char **, unsigned char *)
 
COB_EXPIMP int cob_extern_init (void)
 
COB_EXPIMP int cob_tidy (void)
 
COB_EXPIMP void * cob_command_line (int, int *, char ***, char ***, char **)
 
COB_EXPIMP char * cob_getenv (const char *)
 
COB_EXPIMP int cob_putenv (char *)
 
COB_EXPIMP void cob_incr_temp_iteration (void)
 
COB_EXPIMP void cob_temp_name (char *, const char *)
 
COB_EXPIMP int cob_sys_exit_proc (const void *, const void *)
 
COB_EXPIMP int cob_sys_error_proc (const void *, const void *)
 
COB_EXPIMP int cob_sys_system (const void *)
 
COB_EXPIMP int cob_sys_and (const void *, void *, const int)
 
COB_EXPIMP int cob_sys_or (const void *, void *, const int)
 
COB_EXPIMP int cob_sys_nor (const void *, void *, const int)
 
COB_EXPIMP int cob_sys_xor (const void *, void *, const int)
 
COB_EXPIMP int cob_sys_imp (const void *, void *, const int)
 
COB_EXPIMP int cob_sys_nimp (const void *, void *, const int)
 
COB_EXPIMP int cob_sys_eq (const void *, void *, const int)
 
COB_EXPIMP int cob_sys_not (void *, const int)
 
COB_EXPIMP int cob_sys_xf4 (void *, const void *)
 
COB_EXPIMP int cob_sys_xf5 (const void *, void *)
 
COB_EXPIMP int cob_sys_x91 (void *, const void *, void *)
 
COB_EXPIMP int cob_sys_toupper (void *, const int)
 
COB_EXPIMP int cob_sys_tolower (void *, const int)
 
COB_EXPIMP int cob_sys_oc_nanosleep (const void *)
 
COB_EXPIMP int cob_sys_getpid (void)
 
COB_EXPIMP int cob_sys_return_args (void *)
 
COB_EXPIMP int cob_sys_parameter_size (void *)
 
COB_EXPIMP int cob_sys_getopt_long_long (void *, void *, void *, const int, void *, void *)
 
COB_EXPIMP int cob_sys_sleep (const void *)
 
COB_EXPIMP int cob_sys_calledby (void *)
 
COB_EXPIMP int cob_sys_justify (void *,...)
 
COB_EXPIMP int cob_sys_printable (void *,...)
 
COB_EXPIMP void cob_set_location (const char *, const unsigned int, const char *, const char *, const char *)
 
COB_EXPIMP void cob_trace_section (const char *, const char *, const int)
 
COB_EXPIMP void * cob_external_addr (const char *, const int)
 
COB_EXPIMP unsigned char * cob_get_pointer (const void *)
 
COB_EXPIMP void * cob_get_prog_pointer (const void *)
 
COB_EXPIMP void cob_ready_trace (void)
 
COB_EXPIMP void cob_reset_trace (void)
 
COB_EXPIMP void cob_reg_sighnd (void(*sighnd)(int))
 
COB_EXPIMP int cob_get_switch (const int)
 
COB_EXPIMP void cob_set_switch (const int, const int)
 
COB_EXPIMP int cob_cmp (cob_field *, cob_field *)
 
COB_EXPIMP int cob_is_omitted (const cob_field *)
 
COB_EXPIMP int cob_is_numeric (const cob_field *)
 
COB_EXPIMP int cob_is_alpha (const cob_field *)
 
COB_EXPIMP int cob_is_upper (const cob_field *)
 
COB_EXPIMP int cob_is_lower (const cob_field *)
 
COB_EXPIMP void cob_table_sort_init (const size_t, const unsigned char *)
 
COB_EXPIMP void cob_table_sort_init_key (cob_field *, const int, const unsigned int)
 
COB_EXPIMP void cob_table_sort (cob_field *, const int)
 
COB_EXPIMP void cob_check_numeric (const cob_field *, const char *)
 
COB_EXPIMP void cob_correct_numeric (cob_field *)
 
COB_EXPIMP void cob_check_based (const unsigned char *, const char *)
 
COB_EXPIMP void cob_check_odo (const int, const int, const int, const char *)
 
COB_EXPIMP void cob_check_subscript (const int, const int, const int, const char *)
 
COB_EXPIMP void cob_check_ref_mod (const int, const int, const int, const char *)
 
COB_EXPIMP int cob_numeric_cmp (cob_field *, cob_field *)
 
COB_EXPIMP void cob_inspect_init (cob_field *, const cob_u32_t)
 
COB_EXPIMP void cob_inspect_start (void)
 
COB_EXPIMP void cob_inspect_before (const cob_field *)
 
COB_EXPIMP void cob_inspect_after (const cob_field *)
 
COB_EXPIMP void cob_inspect_characters (cob_field *)
 
COB_EXPIMP void cob_inspect_all (cob_field *, cob_field *)
 
COB_EXPIMP void cob_inspect_leading (cob_field *, cob_field *)
 
COB_EXPIMP void cob_inspect_first (cob_field *, cob_field *)
 
COB_EXPIMP void cob_inspect_trailing (cob_field *, cob_field *)
 
COB_EXPIMP void cob_inspect_converting (const cob_field *, const cob_field *)
 
COB_EXPIMP void cob_inspect_finish (void)
 
COB_EXPIMP void cob_string_init (cob_field *, cob_field *)
 
COB_EXPIMP void cob_string_delimited (cob_field *)
 
COB_EXPIMP void cob_string_append (cob_field *)
 
COB_EXPIMP void cob_string_finish (void)
 
COB_EXPIMP void cob_unstring_init (cob_field *, cob_field *, const size_t)
 
COB_EXPIMP void cob_unstring_delimited (cob_field *, const cob_u32_t)
 
COB_EXPIMP void cob_unstring_into (cob_field *, cob_field *, cob_field *)
 
COB_EXPIMP void cob_unstring_tallying (cob_field *)
 
COB_EXPIMP void cob_unstring_finish (void)
 
COB_EXPIMP void cob_move (cob_field *, cob_field *)
 
COB_EXPIMP void cob_set_int (cob_field *, const int)
 
COB_EXPIMP int cob_get_int (cob_field *)
 
COB_EXPIMP cob_s64_t cob_get_llint (cob_field *)
 
COB_EXPIMP void cob_decimal_init (cob_decimal *)
 
COB_EXPIMP void cob_decimal_set_llint (cob_decimal *, const cob_s64_t)
 
COB_EXPIMP void cob_decimal_set_field (cob_decimal *, cob_field *)
 
COB_EXPIMP int cob_decimal_get_field (cob_decimal *, cob_field *, const int)
 
COB_EXPIMP void cob_decimal_add (cob_decimal *, cob_decimal *)
 
COB_EXPIMP void cob_decimal_sub (cob_decimal *, cob_decimal *)
 
COB_EXPIMP void cob_decimal_mul (cob_decimal *, cob_decimal *)
 
COB_EXPIMP void cob_decimal_div (cob_decimal *, cob_decimal *)
 
COB_EXPIMP void cob_decimal_pow (cob_decimal *, cob_decimal *)
 
COB_EXPIMP int cob_decimal_cmp (cob_decimal *, cob_decimal *)
 
COB_EXPIMP void cob_add (cob_field *, cob_field *, const int)
 
COB_EXPIMP void cob_sub (cob_field *, cob_field *, const int)
 
COB_EXPIMP void cob_mul (cob_field *, cob_field *, const int)
 
COB_EXPIMP void cob_div (cob_field *, cob_field *, const int)
 
COB_EXPIMP int cob_add_int (cob_field *, const int, const int)
 
COB_EXPIMP int cob_sub_int (cob_field *, const int, const int)
 
COB_EXPIMP void cob_div_quotient (cob_field *, cob_field *, cob_field *, const int)
 
COB_EXPIMP void cob_div_remainder (cob_field *, const int)
 
COB_EXPIMP int cob_cmp_int (cob_field *, const int)
 
COB_EXPIMP int cob_cmp_uint (cob_field *, const unsigned int)
 
COB_EXPIMP int cob_cmp_llint (cob_field *, const cob_s64_t)
 
COB_EXPIMP int cob_cmp_packed (cob_field *, const cob_s64_t)
 
COB_EXPIMP int cob_cmp_numdisp (const unsigned char *, const size_t, const cob_s64_t, const cob_u32_t)
 
COB_EXPIMP int cob_cmp_float (cob_field *, cob_field *)
 
COB_EXPIMP void cob_set_packed_zero (cob_field *)
 
COB_EXPIMP void cob_set_packed_int (cob_field *, const int)
 
COB_EXPIMP void cob_decimal_alloc (const cob_u32_t,...)
 
COB_EXPIMP void cob_decimal_push (const cob_u32_t,...)
 
COB_EXPIMP void cob_decimal_pop (const cob_u32_t,...)
 
COB_EXPIMP void cob_gmp_free (void *)
 
DECLNORET COB_EXPIMP void cob_call_error (void) COB_A_NORETURN
 
COB_EXPIMP void cob_set_cancel (cob_module *)
 
COB_EXPIMP void * cob_resolve (const char *)
 
COB_EXPIMP void * cob_resolve_cobol (const char *, const int, const int)
 
COB_EXPIMP void * cob_resolve_func (const char *)
 
COB_EXPIMP const char * cob_resolve_error (void)
 
COB_EXPIMP void * cob_call_field (const cob_field *, const struct cob_call_struct *, const unsigned int, const int)
 
COB_EXPIMP void cob_cancel_field (const cob_field *, const struct cob_call_struct *)
 
COB_EXPIMP void cob_cancel (const char *)
 
COB_EXPIMP int cob_call (const char *, const int, void **)
 
COB_EXPIMP int cob_func (const char *, const int, void **)
 
COB_EXPIMP void * cob_savenv (struct cobjmp_buf *)
 
COB_EXPIMP void * cob_savenv2 (struct cobjmp_buf *, const int)
 
COB_EXPIMP void cob_longjmp (struct cobjmp_buf *)
 
COB_EXPIMP void cob_screen_line_col (cob_field *, const int)
 
COB_EXPIMP void cob_screen_display (cob_screen *, cob_field *, cob_field *)
 
COB_EXPIMP void cob_screen_accept (cob_screen *, cob_field *, cob_field *, cob_field *)
 
COB_EXPIMP void cob_field_display (cob_field *, cob_field *, cob_field *, cob_field *, cob_field *, cob_field *, const int)
 
COB_EXPIMP void cob_field_accept (cob_field *, cob_field *, cob_field *, cob_field *, cob_field *, cob_field *, cob_field *, cob_field *, const int)
 
COB_EXPIMP void cob_accept_escape_key (cob_field *)
 
COB_EXPIMP int cob_sys_clear_screen (void)
 
COB_EXPIMP int cob_sys_sound_bell (void)
 
COB_EXPIMP int cob_sys_get_csr_pos (unsigned char *)
 
COB_EXPIMP int cob_sys_get_scr_size (unsigned char *, unsigned char *)
 
COB_EXPIMP void cob_display (const int, const int, const int,...)
 
COB_EXPIMP void cob_accept (cob_field *)
 
COB_EXPIMP void cob_open (cob_file *, const int, const int, cob_field *)
 
COB_EXPIMP void cob_close (cob_file *, cob_field *, const int, const int)
 
COB_EXPIMP void cob_read (cob_file *, cob_field *, cob_field *, const int)
 
COB_EXPIMP void cob_read_next (cob_file *, cob_field *, const int)
 
COB_EXPIMP void cob_rewrite (cob_file *, cob_field *, const int, cob_field *)
 
COB_EXPIMP void cob_delete (cob_file *, cob_field *)
 
COB_EXPIMP void cob_start (cob_file *, const int, cob_field *, cob_field *, cob_field *)
 
COB_EXPIMP void cob_write (cob_file *, cob_field *, const int, cob_field *, const unsigned int)
 
COB_EXPIMP void cob_delete_file (cob_file *, cob_field *)
 
COB_EXPIMP void cob_unlock_file (cob_file *, cob_field *)
 
COB_EXPIMP void cob_commit (void)
 
COB_EXPIMP void cob_rollback (void)
 
COB_EXPIMP int cob_sys_open_file (unsigned char *, unsigned char *, unsigned char *, unsigned char *, unsigned char *)
 
COB_EXPIMP int cob_sys_create_file (unsigned char *, unsigned char *, unsigned char *, unsigned char *, unsigned char *)
 
COB_EXPIMP int cob_sys_read_file (unsigned char *, unsigned char *, unsigned char *, unsigned char *, unsigned char *)
 
COB_EXPIMP int cob_sys_write_file (unsigned char *, unsigned char *, unsigned char *, unsigned char *, unsigned char *)
 
COB_EXPIMP int cob_sys_close_file (unsigned char *)
 
COB_EXPIMP int cob_sys_flush_file (unsigned char *)
 
COB_EXPIMP int cob_sys_delete_file (unsigned char *)
 
COB_EXPIMP int cob_sys_copy_file (unsigned char *, unsigned char *)
 
COB_EXPIMP int cob_sys_check_file_exist (unsigned char *, unsigned char *)
 
COB_EXPIMP int cob_sys_rename_file (unsigned char *, unsigned char *)
 
COB_EXPIMP int cob_sys_get_current_dir (const int, const int, unsigned char *)
 
COB_EXPIMP int cob_sys_change_dir (unsigned char *)
 
COB_EXPIMP int cob_sys_create_dir (unsigned char *)
 
COB_EXPIMP int cob_sys_delete_dir (unsigned char *)
 
COB_EXPIMP int cob_sys_chdir (unsigned char *, unsigned char *)
 
COB_EXPIMP int cob_sys_mkdir (unsigned char *)
 
COB_EXPIMP int cob_sys_copyfile (unsigned char *, unsigned char *, unsigned char *)
 
COB_EXPIMP int cob_sys_file_info (unsigned char *, unsigned char *)
 
COB_EXPIMP int cob_sys_file_delete (unsigned char *, unsigned char *)
 
COB_EXPIMP void cob_file_sort_init (cob_file *, const unsigned int, const unsigned char *, void *, cob_field *)
 
COB_EXPIMP void cob_file_sort_init_key (cob_file *, cob_field *, const int, const unsigned int)
 
COB_EXPIMP void cob_file_sort_close (cob_file *)
 
COB_EXPIMP void cob_file_sort_using (cob_file *, cob_file *)
 
COB_EXPIMP void cob_file_sort_giving (cob_file *, const size_t,...)
 
COB_EXPIMP void cob_file_release (cob_file *)
 
COB_EXPIMP void cob_file_return (cob_file *)
 
COB_EXPIMP void cob_put_indirect_field (cob_field *)
 
COB_EXPIMP void cob_get_indirect_field (cob_field *)
 
COB_EXPIMP cob_fieldcob_switch_value (const int)
 
COB_EXPIMP cob_fieldcob_intr_binop (cob_field *, const int, cob_field *)
 
COB_EXPIMP int cob_valid_date_format (const char *)
 
COB_EXPIMP int cob_valid_datetime_format (const char *)
 
COB_EXPIMP int cob_valid_time_format (const char *)
 
COB_EXPIMP cob_fieldcob_intr_current_date (const int, const int)
 
COB_EXPIMP cob_fieldcob_intr_when_compiled (const int, const int, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_module_date (void)
 
COB_EXPIMP cob_fieldcob_intr_module_time (void)
 
COB_EXPIMP cob_fieldcob_intr_module_id (void)
 
COB_EXPIMP cob_fieldcob_intr_module_caller_id (void)
 
COB_EXPIMP cob_fieldcob_intr_module_source (void)
 
COB_EXPIMP cob_fieldcob_intr_module_formatted_date (void)
 
COB_EXPIMP cob_fieldcob_intr_module_path (void)
 
COB_EXPIMP cob_fieldcob_intr_exception_file (void)
 
COB_EXPIMP cob_fieldcob_intr_exception_location (void)
 
COB_EXPIMP cob_fieldcob_intr_exception_status (void)
 
COB_EXPIMP cob_fieldcob_intr_exception_statement (void)
 
COB_EXPIMP cob_fieldcob_intr_mon_decimal_point (void)
 
COB_EXPIMP cob_fieldcob_intr_num_decimal_point (void)
 
COB_EXPIMP cob_fieldcob_intr_mon_thousands_sep (void)
 
COB_EXPIMP cob_fieldcob_intr_num_thousands_sep (void)
 
COB_EXPIMP cob_fieldcob_intr_currency_symbol (void)
 
COB_EXPIMP cob_fieldcob_intr_char (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_ord (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_stored_char_length (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_combined_datetime (cob_field *, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_date_of_integer (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_day_of_integer (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_integer_of_date (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_integer_of_day (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_test_date_yyyymmdd (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_test_day_yyyyddd (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_test_numval (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_test_numval_c (cob_field *, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_test_numval_f (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_factorial (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_pi (void)
 
COB_EXPIMP cob_fieldcob_intr_e (void)
 
COB_EXPIMP cob_fieldcob_intr_exp (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_exp10 (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_abs (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_acos (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_asin (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_atan (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_cos (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_log (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_log10 (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_sin (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_sqrt (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_tan (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_upper_case (const int, const int, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_lower_case (const int, const int, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_reverse (const int, const int, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_concatenate (const int, const int, const int,...)
 
COB_EXPIMP cob_fieldcob_intr_substitute (const int, const int, const int,...)
 
COB_EXPIMP cob_fieldcob_intr_substitute_case (const int, const int, const int,...)
 
COB_EXPIMP cob_fieldcob_intr_trim (const int, const int, cob_field *, const int)
 
COB_EXPIMP cob_fieldcob_intr_length (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_byte_length (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_integer (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_integer_part (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_fraction_part (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_sign (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_lowest_algebraic (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_highest_algebraic (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_numval (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_numval_c (cob_field *, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_numval_f (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_annuity (cob_field *, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_mod (cob_field *, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_rem (cob_field *, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_sum (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_ord_min (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_ord_max (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_min (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_max (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_midrange (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_median (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_mean (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_range (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_random (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_variance (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_standard_deviation (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_present_value (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_year_to_yyyy (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_date_to_yyyymmdd (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_day_to_yyyyddd (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_locale_compare (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_locale_date (const int, const int, cob_field *, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_locale_time (const int, const int, cob_field *, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_seconds_past_midnight (void)
 
COB_EXPIMP cob_fieldcob_intr_lcl_time_from_secs (const int, const int, cob_field *, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_seconds_from_formatted_time (cob_field *, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_boolean_of_integer (cob_field *, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_char_national (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_display_of (const int, const int, const int,...)
 
COB_EXPIMP cob_fieldcob_intr_exception_file_n (void)
 
COB_EXPIMP cob_fieldcob_intr_exception_location_n (void)
 
COB_EXPIMP cob_fieldcob_intr_formatted_current_date (const int, const int, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_formatted_date (const int, const int, cob_field *, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_formatted_datetime (const int, const int, const int,...)
 
COB_EXPIMP cob_fieldcob_intr_formatted_time (const int, const int, const int,...)
 
COB_EXPIMP cob_fieldcob_intr_integer_of_boolean (cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_national_of (const int, const int, const int,...)
 
COB_EXPIMP cob_fieldcob_intr_standard_compare (const int,...)
 
COB_EXPIMP cob_fieldcob_intr_test_formatted_datetime (cob_field *, cob_field *)
 
COB_EXPIMP cob_fieldcob_intr_integer_of_formatted_date (cob_field *, cob_field *)
 

Macro Definition Documentation

#define __unaligned
#define __unaligned
#define __unaligned
#define __unaligned
#define __unaligned
#define CB_FMT_LLD   "%lld"
#define CB_FMT_LLD   "%lld"
#define CB_FMT_LLD   "%lld"
#define CB_FMT_LLD   "%lld"
#define CB_FMT_LLD   "%lld"
#define CB_FMT_LLD_F   "%lldLL"
#define CB_FMT_LLD_F   "%lldLL"
#define CB_FMT_LLD_F   "%lldLL"
#define CB_FMT_LLD_F   "%lldLL"
#define CB_FMT_LLD_F   "%lldLL"
#define CB_FMT_LLU   "%llu"
#define CB_FMT_LLU   "%llu"
#define CB_FMT_LLU   "%llu"
#define CB_FMT_LLU   "%llu"
#define CB_FMT_LLU   "%llu"

Referenced by scan_h().

#define CB_FMT_LLU_F   "%lluULL"
#define CB_FMT_LLU_F   "%lluULL"
#define CB_FMT_LLU_F   "%lluULL"
#define CB_FMT_LLU_F   "%lluULL"
#define CB_FMT_LLU_F   "%lluULL"
#define CB_FMT_PLLD   "%+*.*lld"
#define CB_FMT_PLLD   "%+*.*lld"

Referenced by cob_print_realbin().

#define CB_FMT_PLLD   "%+*.*lld"
#define CB_FMT_PLLD   "%+*.*lld"
#define CB_FMT_PLLD   "%+*.*lld"
#define CB_FMT_PLLU   "%*.*llu"
#define CB_FMT_PLLU   "%*.*llu"

Referenced by cob_print_realbin().

#define CB_FMT_PLLU   "%*.*llu"
#define CB_FMT_PLLU   "%*.*llu"
#define CB_FMT_PLLU   "%*.*llu"
#define COB_A_COLD
#define COB_A_COLD
#define COB_A_COLD
#define COB_A_COLD
#define COB_A_COLD
#define COB_A_FORMAT12
#define COB_A_FORMAT12
#define COB_A_FORMAT12
#define COB_A_FORMAT12
#define COB_A_FORMAT12
#define COB_A_FORMAT23
#define COB_A_FORMAT23
#define COB_A_FORMAT23
#define COB_A_FORMAT23
#define COB_A_FORMAT23
#define COB_A_FORMAT34
#define COB_A_FORMAT34
#define COB_A_FORMAT34
#define COB_A_FORMAT34
#define COB_A_FORMAT34
#define COB_A_INLINE
#define COB_A_INLINE
#define COB_A_INLINE
#define COB_A_INLINE
#define COB_A_INLINE
#define COB_A_MALLOC
#define COB_A_MALLOC
#define COB_A_MALLOC
#define COB_A_MALLOC
#define COB_A_MALLOC
#define COB_A_NORETURN
#define COB_A_NORETURN
#define COB_A_NORETURN
#define COB_A_NORETURN
#define COB_A_NORETURN
#define COB_ACCESS_DYNAMIC   2
#define COB_ACCESS_DYNAMIC   2
#define COB_ACCESS_DYNAMIC   2

Referenced by cb_emit_read(), and validate_file().

#define COB_ACCESS_DYNAMIC   2
#define COB_ACCESS_DYNAMIC   2
#define COB_ACCESS_RANDOM   3
#define COB_ACCESS_RANDOM   3
#define COB_ACCESS_RANDOM   3
#define COB_ACCESS_RANDOM   3
#define COB_ACCESS_RANDOM   3
#define COB_ACCESS_SEQUENTIAL   1
#define COB_ACCESS_SEQUENTIAL   1
#define COB_ACCESS_SEQUENTIAL   1
#define COB_ACCESS_SEQUENTIAL   1
#define COB_ASCENDING   0
#define COB_ASCENDING   0
#define COB_ASCENDING   0
#define COB_ASCENDING   0
#define COB_ASCENDING   0
#define COB_BSWAP_16 (   val)    (COB_BSWAP_16_CONSTANT (val))
#define COB_BSWAP_16 (   val)    (COB_BSWAP_16_CONSTANT (val))
#define COB_BSWAP_16 (   val)    (COB_BSWAP_16_CONSTANT (val))
#define COB_BSWAP_16 (   val)    (COB_BSWAP_16_CONSTANT (val))
#define COB_BSWAP_16 (   val)    (COB_BSWAP_16_CONSTANT (val))
#define COB_BSWAP_16_CONSTANT (   val)
Value:
((cob_u16_t) ( \
(((cob_u16_t)(val) & (cob_u16_t) 0x00FFU) << 8) | \
(((cob_u16_t)(val) & (cob_u16_t) 0xFF00U) >> 8)))
#define COB_BSWAP_16_CONSTANT (   val)
Value:
((cob_u16_t) ( \
(((cob_u16_t)(val) & (cob_u16_t) 0x00FFU) << 8) | \
(((cob_u16_t)(val) & (cob_u16_t) 0xFF00U) >> 8)))
#define COB_BSWAP_16_CONSTANT (   val)
Value:
((cob_u16_t) ( \
(((cob_u16_t)(val) & (cob_u16_t) 0x00FFU) << 8) | \
(((cob_u16_t)(val) & (cob_u16_t) 0xFF00U) >> 8)))
#define COB_BSWAP_16_CONSTANT (   val)
Value:
((cob_u16_t) ( \
(((cob_u16_t)(val) & (cob_u16_t) 0x00FFU) << 8) | \
(((cob_u16_t)(val) & (cob_u16_t) 0xFF00U) >> 8)))
#define COB_BSWAP_16_CONSTANT (   val)
Value:
((cob_u16_t) ( \
(((cob_u16_t)(val) & (cob_u16_t) 0x00FFU) << 8) | \
(((cob_u16_t)(val) & (cob_u16_t) 0xFF00U) >> 8)))
#define COB_BSWAP_32 (   val)    (COB_BSWAP_32_CONSTANT (val))
#define COB_BSWAP_32 (   val)    (COB_BSWAP_32_CONSTANT (val))
#define COB_BSWAP_32 (   val)    (COB_BSWAP_32_CONSTANT (val))
#define COB_BSWAP_32 (   val)    (COB_BSWAP_32_CONSTANT (val))
#define COB_BSWAP_32 (   val)    (COB_BSWAP_32_CONSTANT (val))
#define COB_BSWAP_32_CONSTANT (   val)
Value:
((cob_u32_t) ( \
(((cob_u32_t) (val) & (cob_u32_t) 0x000000FFU) << 24) | \
(((cob_u32_t) (val) & (cob_u32_t) 0x0000FF00U) << 8) | \
(((cob_u32_t) (val) & (cob_u32_t) 0x00FF0000U) >> 8) | \
(((cob_u32_t) (val) & (cob_u32_t) 0xFF000000U) >> 24)))
#define COB_BSWAP_32_CONSTANT (   val)
Value:
((cob_u32_t) ( \
(((cob_u32_t) (val) & (cob_u32_t) 0x000000FFU) << 24) | \
(((cob_u32_t) (val) & (cob_u32_t) 0x0000FF00U) << 8) | \
(((cob_u32_t) (val) & (cob_u32_t) 0x00FF0000U) >> 8) | \
(((cob_u32_t) (val) & (cob_u32_t) 0xFF000000U) >> 24)))
#define COB_BSWAP_32_CONSTANT (   val)
Value:
((cob_u32_t) ( \
(((cob_u32_t) (val) & (cob_u32_t) 0x000000FFU) << 24) | \
(((cob_u32_t) (val) & (cob_u32_t) 0x0000FF00U) << 8) | \
(((cob_u32_t) (val) & (cob_u32_t) 0x00FF0000U) >> 8) | \
(((cob_u32_t) (val) & (cob_u32_t) 0xFF000000U) >> 24)))
#define COB_BSWAP_32_CONSTANT (   val)
Value:
((cob_u32_t) ( \
(((cob_u32_t) (val) & (cob_u32_t) 0x000000FFU) << 24) | \
(((cob_u32_t) (val) & (cob_u32_t) 0x0000FF00U) << 8) | \
(((cob_u32_t) (val) & (cob_u32_t) 0x00FF0000U) >> 8) | \
(((cob_u32_t) (val) & (cob_u32_t) 0xFF000000U) >> 24)))
#define COB_BSWAP_32_CONSTANT (   val)
Value:
((cob_u32_t) ( \
(((cob_u32_t) (val) & (cob_u32_t) 0x000000FFU) << 24) | \
(((cob_u32_t) (val) & (cob_u32_t) 0x0000FF00U) << 8) | \
(((cob_u32_t) (val) & (cob_u32_t) 0x00FF0000U) >> 8) | \
(((cob_u32_t) (val) & (cob_u32_t) 0xFF000000U) >> 24)))
#define COB_BSWAP_64 (   val)    (COB_BSWAP_64_CONSTANT (val))
#define COB_BSWAP_64 (   val)    (COB_BSWAP_64_CONSTANT (val))
#define COB_BSWAP_64 (   val)    (COB_BSWAP_64_CONSTANT (val))
#define COB_BSWAP_64 (   val)    (COB_BSWAP_64_CONSTANT (val))
#define COB_BSWAP_64_CONSTANT (   val)
Value:
((cob_u64_t) ( \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x00000000000000FF)) << 56) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x000000000000FF00)) << 40) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x0000000000FF0000)) << 24) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x00000000FF000000)) << 8) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x000000FF00000000)) >> 8) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x0000FF0000000000)) >> 24) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x00FF000000000000)) >> 40) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0xFF00000000000000)) >> 56)))
#define COB_BSWAP_64_CONSTANT (   val)
Value:
((cob_u64_t) ( \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x00000000000000FF)) << 56) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x000000000000FF00)) << 40) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x0000000000FF0000)) << 24) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x00000000FF000000)) << 8) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x000000FF00000000)) >> 8) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x0000FF0000000000)) >> 24) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x00FF000000000000)) >> 40) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0xFF00000000000000)) >> 56)))
#define COB_BSWAP_64_CONSTANT (   val)
Value:
((cob_u64_t) ( \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x00000000000000FF)) << 56) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x000000000000FF00)) << 40) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x0000000000FF0000)) << 24) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x00000000FF000000)) << 8) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x000000FF00000000)) >> 8) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x0000FF0000000000)) >> 24) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x00FF000000000000)) >> 40) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0xFF00000000000000)) >> 56)))
#define COB_BSWAP_64_CONSTANT (   val)
Value:
((cob_u64_t) ( \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x00000000000000FF)) << 56) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x000000000000FF00)) << 40) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x0000000000FF0000)) << 24) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x00000000FF000000)) << 8) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x000000FF00000000)) >> 8) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x0000FF0000000000)) >> 24) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x00FF000000000000)) >> 40) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0xFF00000000000000)) >> 56)))
#define COB_BSWAP_64_CONSTANT (   val)
Value:
((cob_u64_t) ( \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x00000000000000FF)) << 56) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x000000000000FF00)) << 40) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x0000000000FF0000)) << 24) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x00000000FF000000)) << 8) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x000000FF00000000)) >> 8) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x0000FF0000000000)) >> 24) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0x00FF000000000000)) >> 40) | \
(((cob_u64_t) (val) & \
(cob_u64_t) COB_U64_C(0xFF00000000000000)) >> 56)))
#define cob_c8_ptr   cob_c8_t *
#define cob_c8_ptr   cob_c8_t *
#define cob_c8_ptr   cob_c8_t *
#define cob_c8_ptr   cob_c8_t *
#define cob_c8_ptr   cob_c8_t *
#define cob_c8_t   char
#define cob_c8_t   char
#define cob_c8_t   char
#define cob_c8_t   char
#define cob_c8_t   char
#define COB_CLOSE_LOCK   1
#define COB_CLOSE_LOCK   1
#define COB_CLOSE_LOCK   1
#define COB_CLOSE_LOCK   1

Referenced by cob_close(), and cob_file_close().

#define COB_CLOSE_LOCK   1
#define COB_CLOSE_NO_REWIND   2
#define COB_CLOSE_NO_REWIND   2
#define COB_CLOSE_NO_REWIND   2
#define COB_CLOSE_NO_REWIND   2

Referenced by cob_file_close().

#define COB_CLOSE_NO_REWIND   2
#define COB_CLOSE_NORMAL   0
#define COB_CLOSE_NORMAL   0
#define COB_CLOSE_NORMAL   0
#define COB_CLOSE_NORMAL   0
#define COB_CLOSE_UNIT   3
#define COB_CLOSE_UNIT   3
#define COB_CLOSE_UNIT   3
#define COB_CLOSE_UNIT   3
#define COB_CLOSE_UNIT   3
#define COB_CLOSE_UNIT_REMOVAL   4
#define COB_CLOSE_UNIT_REMOVAL   4
#define COB_CLOSE_UNIT_REMOVAL   4
#define COB_CLOSE_UNIT_REMOVAL   4
#define COB_CLOSE_UNIT_REMOVAL   4
#define COB_DESCENDING   1
#define COB_DESCENDING   1
#define COB_DESCENDING   1
#define COB_DESCENDING   1
#define COB_DESCENDING   1
#define COB_DISPLAY_SIGN_ASCII   0
#define COB_DISPLAY_SIGN_ASCII   0
#define COB_DISPLAY_SIGN_ASCII   0
#define COB_DISPLAY_SIGN_ASCII   0
#define COB_DISPLAY_SIGN_ASCII   0
#define COB_DISPLAY_SIGN_EBCDIC   1
#define COB_DISPLAY_SIGN_EBCDIC   1
#define COB_DISPLAY_SIGN_EBCDIC   1
#define COB_DISPLAY_SIGN_EBCDIC   1
#define COB_DISPLAY_SIGN_EBCDIC   1
#define COB_EQ   1 /* x == y */
#define COB_EQ   1 /* x == y */
#define COB_EQ   1 /* x == y */
#define COB_EQ   1 /* x == y */
#define COB_EQ   1 /* x == y */
#define COB_EXCEPTION (   code,
  tag,
  name,
  critical 
)    tag,
#define COB_EXCEPTION (   code,
  tag,
  name,
  critical 
)    tag,
#define COB_EXCEPTION (   code,
  tag,
  name,
  critical 
)    tag,
#define COB_EXCEPTION (   code,
  tag,
  name,
  critical 
)    tag,
#define COB_EXCEPTION (   code,
  tag,
  name,
  critical 
)    tag,
#define COB_EXPIMP   extern
#define COB_EXPIMP   extern
#define COB_EXPIMP   extern
#define COB_EXPIMP   extern
#define COB_EXPIMP   extern
#define COB_FERROR_CANCEL   1
#define COB_FERROR_CANCEL   1

Referenced by cob_fatal_error().

#define COB_FERROR_CANCEL   1
#define COB_FERROR_CANCEL   1
#define COB_FERROR_CANCEL   1
#define COB_FERROR_CHAINING   4
#define COB_FERROR_CHAINING   4

Referenced by cob_fatal_error().

#define COB_FERROR_CHAINING   4
#define COB_FERROR_CHAINING   4
#define COB_FERROR_CHAINING   4
#define COB_FERROR_CODEGEN   3
#define COB_FERROR_CODEGEN   3

Referenced by cob_fatal_error().

#define COB_FERROR_CODEGEN   3
#define COB_FERROR_CODEGEN   3
#define COB_FERROR_CODEGEN   3
#define COB_FERROR_FILE   11
#define COB_FERROR_FILE   11
#define COB_FERROR_FILE   11

Referenced by cob_fatal_error().

#define COB_FERROR_FILE   11
#define COB_FERROR_FILE   11
#define COB_FERROR_FREE   13
#define COB_FERROR_FREE   13
#define COB_FERROR_FREE   13

Referenced by cob_fatal_error(), and cob_free().

#define COB_FERROR_FREE   13
#define COB_FERROR_FREE   13
#define COB_FERROR_FUNCTION   12
#define COB_FERROR_FUNCTION   12
#define COB_FERROR_FUNCTION   12
#define COB_FERROR_FUNCTION   12
#define COB_FERROR_GLOBAL   6
#define COB_FERROR_GLOBAL   6

Referenced by cob_fatal_error().

#define COB_FERROR_GLOBAL   6
#define COB_FERROR_GLOBAL   6
#define COB_FERROR_GLOBAL   6
#define COB_FERROR_INITIALIZED   2
#define COB_FERROR_INITIALIZED   2
#define COB_FERROR_INITIALIZED   2
#define COB_FERROR_INITIALIZED   2
#define COB_FERROR_MEMORY   7
#define COB_FERROR_MEMORY   7
#define COB_FERROR_MEMORY   7
#define COB_FERROR_MEMORY   7
#define COB_FERROR_MEMORY   7
#define COB_FERROR_MODULE   8
#define COB_FERROR_MODULE   8

Referenced by cob_fatal_error().

#define COB_FERROR_MODULE   8
#define COB_FERROR_MODULE   8
#define COB_FERROR_MODULE   8
#define COB_FERROR_NONE   0
#define COB_FERROR_NONE   0

Referenced by cob_fatal_error().

#define COB_FERROR_NONE   0
#define COB_FERROR_NONE   0
#define COB_FERROR_NONE   0
#define COB_FERROR_RECURSIVE   9
#define COB_FERROR_RECURSIVE   9

Referenced by cob_fatal_error().

#define COB_FERROR_RECURSIVE   9
#define COB_FERROR_RECURSIVE   9
#define COB_FERROR_RECURSIVE   9
#define COB_FERROR_SCR_INP   10
#define COB_FERROR_SCR_INP   10
#define COB_FERROR_SCR_INP   10
#define COB_FERROR_SCR_INP   10
#define COB_FERROR_SCR_INP   10
#define COB_FERROR_STACK   5
#define COB_FERROR_STACK   5

Referenced by cob_fatal_error().

#define COB_FERROR_STACK   5
#define COB_FERROR_STACK   5
#define COB_FERROR_STACK   5
#define COB_FI   7 /* First */
#define COB_FI   7 /* First */
#define COB_FI   7 /* First */
#define COB_FI   7 /* First */
#define COB_FI   7 /* First */
#define COB_FIELD_BINARY_SWAP (   f)    ((f)->attr->flags & COB_FLAG_BINARY_SWAP)
#define COB_FIELD_BINARY_SWAP (   f)    ((f)->attr->flags & COB_FLAG_BINARY_SWAP)
#define COB_FIELD_BINARY_SWAP (   f)    ((f)->attr->flags & COB_FLAG_BINARY_SWAP)
#define COB_FIELD_BINARY_SWAP (   f)    ((f)->attr->flags & COB_FLAG_BINARY_SWAP)
#define COB_FIELD_BINARY_TRUNC (   f)    ((f)->attr->flags & COB_FLAG_BINARY_TRUNC)
#define COB_FIELD_BINARY_TRUNC (   f)    ((f)->attr->flags & COB_FLAG_BINARY_TRUNC)
#define COB_FIELD_BINARY_TRUNC (   f)    ((f)->attr->flags & COB_FLAG_BINARY_TRUNC)
#define COB_FIELD_BINARY_TRUNC (   f)    ((f)->attr->flags & COB_FLAG_BINARY_TRUNC)
#define COB_FIELD_BLANK_ZERO (   f)    ((f)->attr->flags & COB_FLAG_BLANK_ZERO)
#define COB_FIELD_BLANK_ZERO (   f)    ((f)->attr->flags & COB_FLAG_BLANK_ZERO)
#define COB_FIELD_BLANK_ZERO (   f)    ((f)->attr->flags & COB_FLAG_BLANK_ZERO)
#define COB_FIELD_BLANK_ZERO (   f)    ((f)->attr->flags & COB_FLAG_BLANK_ZERO)
#define COB_FIELD_BLANK_ZERO (   f)    ((f)->attr->flags & COB_FLAG_BLANK_ZERO)
#define COB_FIELD_DATA (   f)    ((f)->data + (COB_FIELD_SIGN_LEADSEP (f) ? 1 : 0))
#define COB_FIELD_DATA (   f)    ((f)->data + (COB_FIELD_SIGN_LEADSEP (f) ? 1 : 0))
#define COB_FIELD_DATA (   f)    ((f)->data + (COB_FIELD_SIGN_LEADSEP (f) ? 1 : 0))
#define COB_FIELD_DATA (   f)    ((f)->data + (COB_FIELD_SIGN_LEADSEP (f) ? 1 : 0))
#define COB_FIELD_DIGITS (   f)    ((f)->attr->digits)
#define COB_FIELD_DIGITS (   f)    ((f)->attr->digits)
#define COB_FIELD_DIGITS (   f)    ((f)->attr->digits)
#define COB_FIELD_DIGITS (   f)    ((f)->attr->digits)
#define COB_FIELD_FLAGS (   f)    ((f)->attr->flags)
#define COB_FIELD_FLAGS (   f)    ((f)->attr->flags)
#define COB_FIELD_FLAGS (   f)    ((f)->attr->flags)
#define COB_FIELD_FLAGS (   f)    ((f)->attr->flags)
#define COB_FIELD_FLAGS (   f)    ((f)->attr->flags)
#define COB_FIELD_HAVE_SIGN (   f)    ((f)->attr->flags & COB_FLAG_HAVE_SIGN)
#define COB_FIELD_HAVE_SIGN (   f)    ((f)->attr->flags & COB_FLAG_HAVE_SIGN)
#define COB_FIELD_HAVE_SIGN (   f)    ((f)->attr->flags & COB_FLAG_HAVE_SIGN)
#define COB_FIELD_HAVE_SIGN (   f)    ((f)->attr->flags & COB_FLAG_HAVE_SIGN)
#define COB_FIELD_IS_ALNUM (   f)    (COB_FIELD_TYPE (f) == COB_TYPE_ALPHANUMERIC)
#define COB_FIELD_IS_ALNUM (   f)    (COB_FIELD_TYPE (f) == COB_TYPE_ALPHANUMERIC)

Referenced by cob_move_all().

#define COB_FIELD_IS_ALNUM (   f)    (COB_FIELD_TYPE (f) == COB_TYPE_ALPHANUMERIC)
#define COB_FIELD_IS_ALNUM (   f)    (COB_FIELD_TYPE (f) == COB_TYPE_ALPHANUMERIC)
#define COB_FIELD_IS_ALNUM (   f)    (COB_FIELD_TYPE (f) == COB_TYPE_ALPHANUMERIC)
#define COB_FIELD_IS_FP (   f)    ((f)->attr->flags & COB_FLAG_IS_FP)

Referenced by cob_decimal_get_field().

#define COB_FIELD_IS_FP (   f)    ((f)->attr->flags & COB_FLAG_IS_FP)
#define COB_FIELD_IS_FP (   f)    ((f)->attr->flags & COB_FLAG_IS_FP)
#define COB_FIELD_IS_FP (   f)    ((f)->attr->flags & COB_FLAG_IS_FP)
#define COB_FIELD_IS_FP (   f)    ((f)->attr->flags & COB_FLAG_IS_FP)
#define COB_FIELD_IS_NATIONAL (   f)    (COB_FIELD_TYPE (f) & COB_TYPE_NATIONAL)
#define COB_FIELD_IS_NATIONAL (   f)    (COB_FIELD_TYPE (f) & COB_TYPE_NATIONAL)

Referenced by cob_intr_length().

#define COB_FIELD_IS_NATIONAL (   f)    (COB_FIELD_TYPE (f) & COB_TYPE_NATIONAL)
#define COB_FIELD_IS_NATIONAL (   f)    (COB_FIELD_TYPE (f) & COB_TYPE_NATIONAL)
#define COB_FIELD_IS_NATIONAL (   f)    (COB_FIELD_TYPE (f) & COB_TYPE_NATIONAL)
#define COB_FIELD_IS_NUMDISP (   f)    (COB_FIELD_TYPE (f) == COB_TYPE_NUMERIC_DISPLAY)
#define COB_FIELD_IS_NUMDISP (   f)    (COB_FIELD_TYPE (f) == COB_TYPE_NUMERIC_DISPLAY)
#define COB_FIELD_IS_NUMDISP (   f)    (COB_FIELD_TYPE (f) == COB_TYPE_NUMERIC_DISPLAY)
#define COB_FIELD_IS_NUMDISP (   f)    (COB_FIELD_TYPE (f) == COB_TYPE_NUMERIC_DISPLAY)
#define COB_FIELD_IS_NUMDISP (   f)    (COB_FIELD_TYPE (f) == COB_TYPE_NUMERIC_DISPLAY)
#define COB_FIELD_IS_NUMERIC (   f)    (COB_FIELD_TYPE (f) & COB_TYPE_NUMERIC)
#define COB_FIELD_IS_NUMERIC (   f)    (COB_FIELD_TYPE (f) & COB_TYPE_NUMERIC)
#define COB_FIELD_IS_NUMERIC (   f)    (COB_FIELD_TYPE (f) & COB_TYPE_NUMERIC)
#define COB_FIELD_IS_NUMERIC (   f)    (COB_FIELD_TYPE (f) & COB_TYPE_NUMERIC)
#define COB_FIELD_IS_POINTER (   f)    ((f)->attr->flags & COB_FLAG_IS_POINTER)

Referenced by display_common().

#define COB_FIELD_IS_POINTER (   f)    ((f)->attr->flags & COB_FLAG_IS_POINTER)
#define COB_FIELD_IS_POINTER (   f)    ((f)->attr->flags & COB_FLAG_IS_POINTER)
#define COB_FIELD_IS_POINTER (   f)    ((f)->attr->flags & COB_FLAG_IS_POINTER)
#define COB_FIELD_IS_POINTER (   f)    ((f)->attr->flags & COB_FLAG_IS_POINTER)
#define COB_FIELD_JUSTIFIED (   f)    ((f)->attr->flags & COB_FLAG_JUSTIFIED)
#define COB_FIELD_JUSTIFIED (   f)    ((f)->attr->flags & COB_FLAG_JUSTIFIED)
#define COB_FIELD_JUSTIFIED (   f)    ((f)->attr->flags & COB_FLAG_JUSTIFIED)
#define COB_FIELD_JUSTIFIED (   f)    ((f)->attr->flags & COB_FLAG_JUSTIFIED)
#define COB_FIELD_JUSTIFIED (   f)    ((f)->attr->flags & COB_FLAG_JUSTIFIED)
#define COB_FIELD_NO_SIGN_NIBBLE (   f)    ((f)->attr->flags & COB_FLAG_NO_SIGN_NIBBLE)
#define COB_FIELD_NO_SIGN_NIBBLE (   f)    ((f)->attr->flags & COB_FLAG_NO_SIGN_NIBBLE)
#define COB_FIELD_NO_SIGN_NIBBLE (   f)    ((f)->attr->flags & COB_FLAG_NO_SIGN_NIBBLE)
#define COB_FIELD_NO_SIGN_NIBBLE (   f)    ((f)->attr->flags & COB_FLAG_NO_SIGN_NIBBLE)
#define COB_FIELD_PIC (   f)    ((f)->attr->pic)
#define COB_FIELD_PIC (   f)    ((f)->attr->pic)
#define COB_FIELD_PIC (   f)    ((f)->attr->pic)
#define COB_FIELD_PIC (   f)    ((f)->attr->pic)
#define COB_FIELD_PIC (   f)    ((f)->attr->pic)
#define cob_field_ptr   cob_field *
#define cob_field_ptr   cob_field *
#define cob_field_ptr   cob_field *
#define cob_field_ptr   cob_field *
#define cob_field_ptr   cob_field *
#define COB_FIELD_REAL_BINARY (   f)    ((f)->attr->flags & COB_FLAG_REAL_BINARY)
#define COB_FIELD_REAL_BINARY (   f)    ((f)->attr->flags & COB_FLAG_REAL_BINARY)
#define COB_FIELD_REAL_BINARY (   f)    ((f)->attr->flags & COB_FLAG_REAL_BINARY)
#define COB_FIELD_REAL_BINARY (   f)    ((f)->attr->flags & COB_FLAG_REAL_BINARY)
#define COB_FIELD_REAL_SIGN (   f)    ((f)->attr->flags & COB_FLAG_REAL_SIGN)
#define COB_FIELD_REAL_SIGN (   f)    ((f)->attr->flags & COB_FLAG_REAL_SIGN)
#define COB_FIELD_REAL_SIGN (   f)    ((f)->attr->flags & COB_FLAG_REAL_SIGN)
#define COB_FIELD_REAL_SIGN (   f)    ((f)->attr->flags & COB_FLAG_REAL_SIGN)
#define COB_FIELD_REAL_SIGN (   f)    ((f)->attr->flags & COB_FLAG_REAL_SIGN)
#define COB_FIELD_SCALE (   f)    ((f)->attr->scale)
#define COB_FIELD_SCALE (   f)    ((f)->attr->scale)
#define COB_FIELD_SCALE (   f)    ((f)->attr->scale)
#define COB_FIELD_SCALE (   f)    ((f)->attr->scale)
#define COB_FIELD_SIGN_LEADING (   f)    ((f)->attr->flags & COB_FLAG_SIGN_LEADING)
#define COB_FIELD_SIGN_LEADING (   f)    ((f)->attr->flags & COB_FLAG_SIGN_LEADING)
#define COB_FIELD_SIGN_LEADING (   f)    ((f)->attr->flags & COB_FLAG_SIGN_LEADING)
#define COB_FIELD_SIGN_LEADING (   f)    ((f)->attr->flags & COB_FLAG_SIGN_LEADING)
#define COB_FIELD_SIGN_LEADING (   f)    ((f)->attr->flags & COB_FLAG_SIGN_LEADING)
#define COB_FIELD_SIGN_LEADSEP (   f)    (((f)->attr->flags & COB_FLAG_LEADSEP) == COB_FLAG_LEADSEP)
#define COB_FIELD_SIGN_LEADSEP (   f)    (((f)->attr->flags & COB_FLAG_LEADSEP) == COB_FLAG_LEADSEP)
#define COB_FIELD_SIGN_LEADSEP (   f)    (((f)->attr->flags & COB_FLAG_LEADSEP) == COB_FLAG_LEADSEP)
#define COB_FIELD_SIGN_LEADSEP (   f)    (((f)->attr->flags & COB_FLAG_LEADSEP) == COB_FLAG_LEADSEP)
#define COB_FIELD_SIGN_LEADSEP (   f)    (((f)->attr->flags & COB_FLAG_LEADSEP) == COB_FLAG_LEADSEP)
#define COB_FIELD_SIGN_SEPARATE (   f)    ((f)->attr->flags & COB_FLAG_SIGN_SEPARATE)
#define COB_FIELD_SIGN_SEPARATE (   f)    ((f)->attr->flags & COB_FLAG_SIGN_SEPARATE)
#define COB_FIELD_SIGN_SEPARATE (   f)    ((f)->attr->flags & COB_FLAG_SIGN_SEPARATE)
#define COB_FIELD_SIGN_SEPARATE (   f)    ((f)->attr->flags & COB_FLAG_SIGN_SEPARATE)
#define COB_FIELD_SIGN_SEPARATE (   f)    ((f)->attr->flags & COB_FLAG_SIGN_SEPARATE)
#define COB_FIELD_SIZE (   f)    (COB_FIELD_SIGN_SEPARATE (f) ? f->size - 1 : f->size)
#define COB_FIELD_SIZE (   f)    (COB_FIELD_SIGN_SEPARATE (f) ? f->size - 1 : f->size)
#define COB_FIELD_SIZE (   f)    (COB_FIELD_SIGN_SEPARATE (f) ? f->size - 1 : f->size)
#define COB_FIELD_SIZE (   f)    (COB_FIELD_SIGN_SEPARATE (f) ? f->size - 1 : f->size)
#define COB_FIELD_TYPE (   f)    ((f)->attr->type)
#define COB_FIELD_TYPE (   f)    ((f)->attr->type)
#define COB_FIELD_TYPE (   f)    ((f)->attr->type)
#define COB_FIELD_TYPE (   f)    ((f)->attr->type)
#define COB_FILE_BUFF   4096
#define COB_FILE_BUFF   4096
#define COB_FILE_BUFF   4096
#define COB_FILE_BUFF   4096
#define COB_FILE_BUFF   4096
#define COB_FILE_EXCLUSIVE   (COB_LOCK_EXCLUSIVE | COB_LOCK_OPEN_EXCLUSIVE)
#define COB_FILE_EXCLUSIVE   (COB_LOCK_EXCLUSIVE | COB_LOCK_OPEN_EXCLUSIVE)
#define COB_FILE_EXCLUSIVE   (COB_LOCK_EXCLUSIVE | COB_LOCK_OPEN_EXCLUSIVE)
#define COB_FILE_EXCLUSIVE   (COB_LOCK_EXCLUSIVE | COB_LOCK_OPEN_EXCLUSIVE)
#define cob_file_key_ptr   cob_file_key *
#define cob_file_key_ptr   cob_file_key *
#define cob_file_key_ptr   cob_file_key *
#define cob_file_key_ptr   cob_file_key *
#define cob_file_key_ptr   cob_file_key *
#define COB_FILE_MAX   (COB_FILE_BUFF - 1)
#define COB_FILE_MAX   (COB_FILE_BUFF - 1)
#define COB_FILE_MAX   (COB_FILE_BUFF - 1)
#define COB_FILE_MAX   (COB_FILE_BUFF - 1)
#define COB_FILE_MODE   0644

Referenced by indexed_open().

#define COB_FILE_MODE   0644
#define COB_FILE_MODE   0644
#define COB_FILE_MODE   0644
#define COB_FILE_MODE   0644
#define cob_file_ptr   cob_file *
#define cob_file_ptr   cob_file *
#define cob_file_ptr   cob_file *
#define cob_file_ptr   cob_file *
#define cob_file_ptr   cob_file *
#define COB_FILE_SPECIAL (   x)    ((x)->flag_select_features & (COB_SELECT_STDIN | COB_SELECT_STDOUT))
#define COB_FILE_SPECIAL (   x)    ((x)->flag_select_features & (COB_SELECT_STDIN | COB_SELECT_STDOUT))
#define COB_FILE_SPECIAL (   x)    ((x)->flag_select_features & (COB_SELECT_STDIN | COB_SELECT_STDOUT))
#define COB_FILE_SPECIAL (   x)    ((x)->flag_select_features & (COB_SELECT_STDIN | COB_SELECT_STDOUT))
#define COB_FILE_SPECIAL (   x)    ((x)->flag_select_features & (COB_SELECT_STDIN | COB_SELECT_STDOUT))
#define COB_FILE_STDIN (   x)    ((x)->flag_select_features & COB_SELECT_STDIN)
#define COB_FILE_STDIN (   x)    ((x)->flag_select_features & COB_SELECT_STDIN)
#define COB_FILE_STDIN (   x)    ((x)->flag_select_features & COB_SELECT_STDIN)
#define COB_FILE_STDIN (   x)    ((x)->flag_select_features & COB_SELECT_STDIN)

Referenced by cob_delete_file(), and cob_open().

#define COB_FILE_STDIN (   x)    ((x)->flag_select_features & COB_SELECT_STDIN)
#define COB_FILE_STDOUT (   x)    ((x)->flag_select_features & COB_SELECT_STDOUT)
#define COB_FILE_STDOUT (   x)    ((x)->flag_select_features & COB_SELECT_STDOUT)
#define COB_FILE_STDOUT (   x)    ((x)->flag_select_features & COB_SELECT_STDOUT)
#define COB_FILE_STDOUT (   x)    ((x)->flag_select_features & COB_SELECT_STDOUT)

Referenced by cob_delete_file(), and cob_open().

#define COB_FILE_STDOUT (   x)    ((x)->flag_select_features & COB_SELECT_STDOUT)
#define COB_FILE_TEMPORARY (   x)    ((x)->flag_select_features & COB_SELECT_TEMPORARY)
#define COB_FILE_TEMPORARY (   x)    ((x)->flag_select_features & COB_SELECT_TEMPORARY)
#define COB_FILE_TEMPORARY (   x)    ((x)->flag_select_features & COB_SELECT_TEMPORARY)
#define COB_FILE_TEMPORARY (   x)    ((x)->flag_select_features & COB_SELECT_TEMPORARY)
#define COB_FILE_TEMPORARY (   x)    ((x)->flag_select_features & COB_SELECT_TEMPORARY)
#define COB_FILE_VERSION   1
#define COB_FILE_VERSION   1
#define COB_FILE_VERSION   1
#define COB_FILE_VERSION   1
#define COB_FILE_VERSION   1
#define COB_FLAG_BINARY_SWAP   (1U << 5) /* 0x0020 */
#define COB_FLAG_BINARY_SWAP   (1U << 5) /* 0x0020 */
#define COB_FLAG_BINARY_SWAP   (1U << 5) /* 0x0020 */
#define COB_FLAG_BINARY_SWAP   (1U << 5) /* 0x0020 */
#define COB_FLAG_BINARY_SWAP   (1U << 5) /* 0x0020 */

Referenced by output_attr().

#define COB_FLAG_BINARY_TRUNC   (1U << 11) /* 0x0800 */

Referenced by output_attr().

#define COB_FLAG_BINARY_TRUNC   (1U << 11) /* 0x0800 */
#define COB_FLAG_BINARY_TRUNC   (1U << 11) /* 0x0800 */
#define COB_FLAG_BINARY_TRUNC   (1U << 11) /* 0x0800 */
#define COB_FLAG_BINARY_TRUNC   (1U << 11) /* 0x0800 */
#define COB_FLAG_BLANK_ZERO   (1U << 3) /* 0x0008 */
#define COB_FLAG_BLANK_ZERO   (1U << 3) /* 0x0008 */
#define COB_FLAG_BLANK_ZERO   (1U << 3) /* 0x0008 */
#define COB_FLAG_BLANK_ZERO   (1U << 3) /* 0x0008 */
#define COB_FLAG_BLANK_ZERO   (1U << 3) /* 0x0008 */

Referenced by output_attr().

#define COB_FLAG_HAVE_SIGN   (1U << 0) /* 0x0001 */
#define COB_FLAG_HAVE_SIGN   (1U << 0) /* 0x0001 */
#define COB_FLAG_HAVE_SIGN   (1U << 0) /* 0x0001 */
#define COB_FLAG_HAVE_SIGN   (1U << 0) /* 0x0001 */
#define COB_FLAG_IS_FP   (1U << 9) /* 0x0200 */

Referenced by output_attr().

#define COB_FLAG_IS_FP   (1U << 9) /* 0x0200 */
#define COB_FLAG_IS_FP   (1U << 9) /* 0x0200 */
#define COB_FLAG_IS_FP   (1U << 9) /* 0x0200 */
#define COB_FLAG_IS_FP   (1U << 9) /* 0x0200 */
#define COB_FLAG_IS_POINTER   (1U << 7) /* 0x0080 */
#define COB_FLAG_IS_POINTER   (1U << 7) /* 0x0080 */
#define COB_FLAG_IS_POINTER   (1U << 7) /* 0x0080 */
#define COB_FLAG_IS_POINTER   (1U << 7) /* 0x0080 */
#define COB_FLAG_IS_POINTER   (1U << 7) /* 0x0080 */

Referenced by output_attr().

#define COB_FLAG_JUSTIFIED   (1U << 4) /* 0x0010 */
#define COB_FLAG_JUSTIFIED   (1U << 4) /* 0x0010 */
#define COB_FLAG_JUSTIFIED   (1U << 4) /* 0x0010 */
#define COB_FLAG_JUSTIFIED   (1U << 4) /* 0x0010 */
#define COB_FLAG_JUSTIFIED   (1U << 4) /* 0x0010 */

Referenced by output_attr().

#define COB_FLAG_NO_SIGN_NIBBLE   (1U << 8) /* 0x0100 */
#define COB_FLAG_NO_SIGN_NIBBLE   (1U << 8) /* 0x0100 */
#define COB_FLAG_NO_SIGN_NIBBLE   (1U << 8) /* 0x0100 */
#define COB_FLAG_NO_SIGN_NIBBLE   (1U << 8) /* 0x0100 */
#define COB_FLAG_NO_SIGN_NIBBLE   (1U << 8) /* 0x0100 */

Referenced by output_attr().

#define COB_FLAG_REAL_BINARY   (1U << 6) /* 0x0040 */
#define COB_FLAG_REAL_BINARY   (1U << 6) /* 0x0040 */
#define COB_FLAG_REAL_BINARY   (1U << 6) /* 0x0040 */
#define COB_FLAG_REAL_BINARY   (1U << 6) /* 0x0040 */
#define COB_FLAG_REAL_BINARY   (1U << 6) /* 0x0040 */
#define COB_FLAG_REAL_SIGN   (1U << 10) /* 0x0400 */
#define COB_FLAG_REAL_SIGN   (1U << 10) /* 0x0400 */
#define COB_FLAG_REAL_SIGN   (1U << 10) /* 0x0400 */
#define COB_FLAG_REAL_SIGN   (1U << 10) /* 0x0400 */
#define COB_FLAG_REAL_SIGN   (1U << 10) /* 0x0400 */
#define COB_FLAG_SIGN_LEADING   (1U << 2) /* 0x0004 */
#define COB_FLAG_SIGN_LEADING   (1U << 2) /* 0x0004 */
#define COB_FLAG_SIGN_LEADING   (1U << 2) /* 0x0004 */
#define COB_FLAG_SIGN_LEADING   (1U << 2) /* 0x0004 */
#define COB_FLAG_SIGN_LEADING   (1U << 2) /* 0x0004 */

Referenced by display_numeric(), and output_attr().

#define COB_FLAG_SIGN_SEPARATE   (1U << 1) /* 0x0002 */
#define COB_FLAG_SIGN_SEPARATE   (1U << 1) /* 0x0002 */
#define COB_FLAG_SIGN_SEPARATE   (1U << 1) /* 0x0002 */
#define COB_FLAG_SIGN_SEPARATE   (1U << 1) /* 0x0002 */
#define COB_FLAG_SIGN_SEPARATE   (1U << 1) /* 0x0002 */

Referenced by display_numeric(), and output_attr().

#define COB_FOLD_LOWER   2
#define COB_FOLD_LOWER   2
#define COB_FOLD_LOWER   2
#define COB_FOLD_LOWER   2
#define COB_FOLD_LOWER   2
#define COB_FOLD_UPPER   1
#define COB_FOLD_UPPER   1
#define COB_FOLD_UPPER   1
#define COB_FOLD_UPPER   1
#define COB_FOLD_UPPER   1
#define COB_GE   5 /* x >= y */
#define COB_GE   5 /* x >= y */
#define COB_GE   5 /* x >= y */
#define COB_GE   5 /* x >= y */
#define COB_GE   5 /* x >= y */
#define COB_GT   4 /* x > y */
#define COB_GT   4 /* x > y */
#define COB_GT   4 /* x > y */
#define COB_GT   4 /* x > y */
#define COB_GT   4 /* x > y */
#define COB_INLINE   COB_KEYWORD_INLINE
#define COB_INLINE   COB_KEYWORD_INLINE
#define COB_INLINE   COB_KEYWORD_INLINE
#define COB_INLINE   COB_KEYWORD_INLINE
#define COB_INLINE
#define COB_LA   8 /* Last */
#define COB_LA   8 /* Last */
#define COB_LA   8 /* Last */
#define COB_LA   8 /* Last */
#define COB_LA   8 /* Last */
#define COB_LARGE_BUFF   16384
#define COB_LARGE_BUFF   16384
#define COB_LARGE_BUFF   16384
#define COB_LARGE_BUFF   16384
#define COB_LARGE_BUFF   16384
#define COB_LARGE_MAX   (COB_LARGE_BUFF - 1)
#define COB_LARGE_MAX   (COB_LARGE_BUFF - 1)

Referenced by cob_init(), and main().

#define COB_LARGE_MAX   (COB_LARGE_BUFF - 1)
#define COB_LARGE_MAX   (COB_LARGE_BUFF - 1)
#define COB_LARGE_MAX   (COB_LARGE_BUFF - 1)
#define COB_LC_ALL   6
#define COB_LC_ALL   6

Referenced by cob_set_locale().

#define COB_LC_ALL   6
#define COB_LC_ALL   6
#define COB_LC_ALL   6
#define COB_LC_CLASS   8
#define COB_LC_CLASS   8
#define COB_LC_CLASS   8

Referenced by cob_set_locale().

#define COB_LC_CLASS   8
#define COB_LC_CLASS   8
#define COB_LC_COLLATE   0
#define COB_LC_COLLATE   0

Referenced by cob_set_locale().

#define COB_LC_COLLATE   0
#define COB_LC_COLLATE   0
#define COB_LC_COLLATE   0
#define COB_LC_CTYPE   1
#define COB_LC_CTYPE   1
#define COB_LC_CTYPE   1

Referenced by cob_set_locale().

#define COB_LC_CTYPE   1
#define COB_LC_CTYPE   1
#define COB_LC_MESSAGES   2
#define COB_LC_MESSAGES   2

Referenced by cob_set_locale().

#define COB_LC_MESSAGES   2
#define COB_LC_MESSAGES   2
#define COB_LC_MESSAGES   2
#define COB_LC_MONETARY   3
#define COB_LC_MONETARY   3

Referenced by cob_set_locale().

#define COB_LC_MONETARY   3
#define COB_LC_MONETARY   3
#define COB_LC_MONETARY   3
#define COB_LC_NUMERIC   4
#define COB_LC_NUMERIC   4

Referenced by cob_set_locale().

#define COB_LC_NUMERIC   4
#define COB_LC_NUMERIC   4
#define COB_LC_NUMERIC   4
#define COB_LC_TIME   5
#define COB_LC_TIME   5
#define COB_LC_TIME   5

Referenced by cob_set_locale().

#define COB_LC_TIME   5
#define COB_LC_TIME   5
#define COB_LC_USER   7
#define COB_LC_USER   7
#define COB_LC_USER   7

Referenced by cob_set_locale().

#define COB_LC_USER   7
#define COB_LC_USER   7
#define COB_LE   3 /* x <= y */
#define COB_LE   3 /* x <= y */
#define COB_LE   3 /* x <= y */
#define COB_LE   3 /* x <= y */
#define COB_LE   3 /* x <= y */
#define COB_LOCK_AUTOMATIC   (1U << 2)
#define COB_LOCK_AUTOMATIC   (1U << 2)
#define COB_LOCK_AUTOMATIC   (1U << 2)
#define COB_LOCK_AUTOMATIC   (1U << 2)
#define COB_LOCK_EXCLUSIVE   (1U << 0)
#define COB_LOCK_EXCLUSIVE   (1U << 0)
#define COB_LOCK_EXCLUSIVE   (1U << 0)
#define COB_LOCK_EXCLUSIVE   (1U << 0)
#define COB_LOCK_EXCLUSIVE   (1U << 0)
#define COB_LOCK_MANUAL   (1U << 1)
#define COB_LOCK_MANUAL   (1U << 1)
#define COB_LOCK_MANUAL   (1U << 1)
#define COB_LOCK_MANUAL   (1U << 1)
#define COB_LOCK_MANUAL   (1U << 1)
#define COB_LOCK_MULTIPLE   (1U << 3)
#define COB_LOCK_MULTIPLE   (1U << 3)
#define COB_LOCK_MULTIPLE   (1U << 3)
#define COB_LOCK_MULTIPLE   (1U << 3)
#define COB_LOCK_MULTIPLE   (1U << 3)
#define COB_LOCK_OPEN_EXCLUSIVE   (1U << 4)
#define COB_LOCK_OPEN_EXCLUSIVE   (1U << 4)
#define COB_LOCK_OPEN_EXCLUSIVE   (1U << 4)
#define COB_LOCK_OPEN_EXCLUSIVE   (1U << 4)

Referenced by cob_close(), and cob_open().

#define COB_LOCK_OPEN_EXCLUSIVE   (1U << 4)
#define COB_LT   2 /* x < y */
#define COB_LT   2 /* x < y */
#define COB_LT   2 /* x < y */
#define COB_LT   2 /* x < y */
#define COB_LT   2 /* x < y */
#define COB_MAX_BINARY   39
#define COB_MAX_BINARY   39
#define COB_MAX_BINARY   39
#define COB_MAX_BINARY   39
#define COB_MAX_DEC_STRUCT   32
#define COB_MAX_DEC_STRUCT   32
#define COB_MAX_DEC_STRUCT   32
#define COB_MAX_DEC_STRUCT   32
#define COB_MAX_DEC_STRUCT   32
#define COB_MAX_DIGITS   38
#define COB_MAX_DIGITS   38
#define COB_MAX_DIGITS   38
#define COB_MAX_DIGITS   38
#define COB_MAX_FIELD_PARAMS   36
#define COB_MAX_FIELD_PARAMS   36
#define COB_MAX_FIELD_PARAMS   36
#define COB_MAX_FIELD_PARAMS   36
#define COB_MAX_FIELD_PARAMS   36
#define COB_MAX_FIELD_SIZE   268435456
#define COB_MAX_FIELD_SIZE   268435456

Referenced by compute_size().

#define COB_MAX_FIELD_SIZE   268435456
#define COB_MAX_FIELD_SIZE   268435456
#define COB_MAX_FIELD_SIZE   268435456
#define COB_MAX_WORDLEN   61
#define COB_MAX_WORDLEN   61

Referenced by while().

#define COB_MAX_WORDLEN   61
#define COB_MAX_WORDLEN   61
#define COB_MAX_WORDLEN   61
#define COB_MEDIUM_BUFF   8192
#define COB_MEDIUM_BUFF   8192
#define COB_MEDIUM_BUFF   8192
#define COB_MEDIUM_BUFF   8192
#define COB_MEDIUM_BUFF   8192
#define COB_MEDIUM_MAX   (COB_MEDIUM_BUFF - 1)
#define COB_MEDIUM_MAX   (COB_MEDIUM_BUFF - 1)
#define COB_MEDIUM_MAX   (COB_MEDIUM_BUFF - 1)
#define COB_MEDIUM_MAX   (COB_MEDIUM_BUFF - 1)
#define COB_MINI_BUFF   256
#define COB_MINI_BUFF   256
#define COB_MINI_BUFF   256
#define COB_MINI_BUFF   256
#define COB_MINI_MAX   (COB_MINI_BUFF - 1)
#define COB_MINI_MAX   (COB_MINI_BUFF - 1)
#define COB_MINI_MAX   (COB_MINI_BUFF - 1)
#define COB_MINI_MAX   (COB_MINI_BUFF - 1)
#define cob_module_ptr   cob_module *
#define cob_module_ptr   cob_module *
#define cob_module_ptr   cob_module *
#define cob_module_ptr   cob_module *
#define cob_module_ptr   cob_module *
#define COB_NATIONAL_SIZE   2
#define COB_NATIONAL_SIZE   2
#define COB_NATIONAL_SIZE   2
#define COB_NATIONAL_SIZE   2
#define COB_NATIONAL_SIZE   2
#define COB_NE   6 /* x != y */
#define COB_NE   6 /* x != y */
#define COB_NE   6 /* x != y */
#define COB_NE   6 /* x != y */
#define COB_NE   6 /* x != y */
#define COB_NOINLINE
#define COB_NOINLINE
#define COB_NOINLINE
#define COB_NOINLINE
#define COB_NOINLINE
#define COB_NON_ALIGNED
#define COB_NON_ALIGNED
#define COB_NON_ALIGNED
#define COB_NON_ALIGNED
#define COB_NON_ALIGNED
#define COB_NORMAL_BUFF   2048
#define COB_NORMAL_BUFF   2048
#define COB_NORMAL_BUFF   2048
#define COB_NORMAL_BUFF   2048
#define COB_NORMAL_MAX   (COB_NORMAL_BUFF - 1)
#define COB_NORMAL_MAX   (COB_NORMAL_BUFF - 1)
#define COB_NORMAL_MAX   (COB_NORMAL_BUFF - 1)
#define COB_NORMAL_MAX   (COB_NORMAL_BUFF - 1)
#define COB_NOT_CONFIGURED   32768
#define COB_NOT_CONFIGURED   32768
#define COB_NOT_CONFIGURED   32768
#define COB_NOT_CONFIGURED   32768
#define COB_OPEN_CLOSED   0
#define COB_OPEN_CLOSED   0
#define COB_OPEN_CLOSED   0
#define COB_OPEN_CLOSED   0
#define COB_OPEN_EXTEND   4
#define COB_OPEN_EXTEND   4
#define COB_OPEN_EXTEND   4
#define COB_OPEN_EXTEND   4
#define COB_OPEN_I_O   3
#define COB_OPEN_I_O   3
#define COB_OPEN_I_O   3
#define COB_OPEN_I_O   3
#define COB_OPEN_INPUT   1
#define COB_OPEN_INPUT   1
#define COB_OPEN_INPUT   1
#define COB_OPEN_INPUT   1
#define COB_OPEN_LOCKED   5
#define COB_OPEN_LOCKED   5
#define COB_OPEN_LOCKED   5
#define COB_OPEN_LOCKED   5
#define COB_OPEN_LOCKED   5
#define COB_OPEN_OUTPUT   2
#define COB_OPEN_OUTPUT   2
#define COB_OPEN_OUTPUT   2
#define COB_OPEN_OUTPUT   2
#define COB_ORG_INDEXED   3
#define COB_ORG_INDEXED   3
#define COB_ORG_INDEXED   3
#define COB_ORG_INDEXED   3
#define COB_ORG_LINE_SEQUENTIAL   1
#define COB_ORG_LINE_SEQUENTIAL   1
#define COB_ORG_LINE_SEQUENTIAL   1
#define COB_ORG_LINE_SEQUENTIAL   1
#define COB_ORG_MAX   5
#define COB_ORG_MAX   5
#define COB_ORG_MAX   5
#define COB_ORG_MAX   5
#define COB_ORG_MAX   5
#define COB_ORG_RELATIVE   2
#define COB_ORG_RELATIVE   2
#define COB_ORG_RELATIVE   2
#define COB_ORG_RELATIVE   2
#define COB_ORG_SEQUENTIAL   0
#define COB_ORG_SEQUENTIAL   0
#define COB_ORG_SEQUENTIAL   0
#define COB_ORG_SEQUENTIAL   0
#define COB_ORG_SEQUENTIAL   0
#define COB_ORG_SORT   4
#define COB_ORG_SORT   4
#define COB_ORG_SORT   4
#define COB_ORG_SORT   4
#define COB_READ_FIRST   (1 << 2)
#define COB_READ_FIRST   (1 << 2)
#define COB_READ_FIRST   (1 << 2)
#define COB_READ_FIRST   (1 << 2)
#define COB_READ_FIRST   (1 << 2)
#define COB_READ_IGNORE_LOCK   (1 << 8)
#define COB_READ_IGNORE_LOCK   (1 << 8)
#define COB_READ_IGNORE_LOCK   (1 << 8)
#define COB_READ_IGNORE_LOCK   (1 << 8)
#define COB_READ_IGNORE_LOCK   (1 << 8)

Referenced by cb_emit_read().

#define COB_READ_KEPT_LOCK   (1 << 6)
#define COB_READ_KEPT_LOCK   (1 << 6)
#define COB_READ_KEPT_LOCK   (1 << 6)
#define COB_READ_KEPT_LOCK   (1 << 6)
#define COB_READ_KEPT_LOCK   (1 << 6)
#define COB_READ_LAST   (1 << 3)
#define COB_READ_LAST   (1 << 3)
#define COB_READ_LAST   (1 << 3)
#define COB_READ_LAST   (1 << 3)
#define COB_READ_LAST   (1 << 3)
#define COB_READ_LOCK   (1 << 4)
#define COB_READ_LOCK   (1 << 4)
#define COB_READ_LOCK   (1 << 4)
#define COB_READ_LOCK   (1 << 4)
#define COB_READ_LOCK   (1 << 4)
#define COB_READ_NEXT   (1 << 0)
#define COB_READ_NEXT   (1 << 0)
#define COB_READ_NEXT   (1 << 0)
#define COB_READ_NEXT   (1 << 0)
#define COB_READ_NEXT   (1 << 0)
#define COB_READ_NO_LOCK   (1 << 5)
#define COB_READ_NO_LOCK   (1 << 5)
#define COB_READ_NO_LOCK   (1 << 5)
#define COB_READ_NO_LOCK   (1 << 5)
#define COB_READ_NO_LOCK   (1 << 5)
#define COB_READ_PREVIOUS   (1 << 1)
#define COB_READ_PREVIOUS   (1 << 1)
#define COB_READ_PREVIOUS   (1 << 1)
#define COB_READ_PREVIOUS   (1 << 1)
#define COB_READ_PREVIOUS   (1 << 1)
#define COB_READ_WAIT_LOCK   (1 << 7)
#define COB_READ_WAIT_LOCK   (1 << 7)
#define COB_READ_WAIT_LOCK   (1 << 7)
#define COB_READ_WAIT_LOCK   (1 << 7)
#define COB_READ_WAIT_LOCK   (1 << 7)
#define COB_RET_TYPE_INT   0
#define COB_RET_TYPE_INT   0
#define COB_RET_TYPE_INT   0
#define COB_RET_TYPE_INT   0
#define COB_RET_TYPE_INT   0
#define COB_RET_TYPE_PTR   1
#define COB_RET_TYPE_PTR   1
#define COB_RET_TYPE_PTR   1
#define COB_RET_TYPE_PTR   1
#define COB_RET_TYPE_PTR   1
#define COB_RET_TYPE_VOID   2
#define COB_RET_TYPE_VOID   2
#define COB_RET_TYPE_VOID   2
#define COB_RET_TYPE_VOID   2
#define COB_RET_TYPE_VOID   2
#define cob_s16_ptr   cob_s16_t *
#define cob_s16_ptr   cob_s16_t *
#define cob_s16_ptr   cob_s16_t *
#define cob_s16_ptr   cob_s16_t *
#define cob_s16_ptr   cob_s16_t *
#define cob_s16_t   short
#define cob_s16_t   short
#define cob_s16_t   short
#define cob_s16_t   short
#define cob_s16_t   short
#define cob_s32_ptr   cob_s32_t *
#define cob_s32_ptr   cob_s32_t *
#define cob_s32_ptr   cob_s32_t *
#define cob_s32_ptr   cob_s32_t *
#define cob_s32_ptr   cob_s32_t *
#define cob_s32_t   int
#define cob_s32_t   int
#define cob_s32_t   int
#define cob_s32_t   int
#define cob_s32_t   int
#define COB_S64_C (   x)    x ## LL
#define COB_S64_C (   x)    x ## LL
#define COB_S64_C (   x)    x ## LL
#define COB_S64_C (   x)    x ## LL

Referenced by validate_move().

#define COB_S64_C (   x)    x ## LL
#define cob_s64_ptr   cob_s64_t *
#define cob_s64_ptr   cob_s64_t *
#define cob_s64_ptr   cob_s64_t *
#define cob_s64_ptr   cob_s64_t *
#define cob_s64_ptr   cob_s64_t *
#define cob_s64_t   long long
#define cob_s64_t   long long
#define cob_s64_t   long long
#define cob_s64_t   long long
#define cob_s8_ptr   cob_s8_t *
#define cob_s8_ptr   cob_s8_t *
#define cob_s8_ptr   cob_s8_t *
#define cob_s8_ptr   cob_s8_t *
#define cob_s8_ptr   cob_s8_t *
#define cob_s8_t   signed char
#define cob_s8_t   signed char
#define cob_s8_t   signed char
#define cob_s8_t   signed char
#define cob_s8_t   signed char
#define COB_SCREEN_AUTO   (1 << 4)
#define COB_SCREEN_AUTO   (1 << 4)
#define COB_SCREEN_AUTO   (1 << 4)
#define COB_SCREEN_AUTO   (1 << 4)
#define COB_SCREEN_AUTO   (1 << 4)
#define COB_SCREEN_BELL   (1 << 5)

Referenced by cb_emit_display().

#define COB_SCREEN_BELL   (1 << 5)
#define COB_SCREEN_BELL   (1 << 5)
#define COB_SCREEN_BELL   (1 << 5)
#define COB_SCREEN_BELL   (1 << 5)
#define COB_SCREEN_BLACK   0
#define COB_SCREEN_BLACK   0
#define COB_SCREEN_BLACK   0
#define COB_SCREEN_BLACK   0
#define COB_SCREEN_BLACK   0
#define COB_SCREEN_BLANK_LINE   (1 << 6)
#define COB_SCREEN_BLANK_LINE   (1 << 6)
#define COB_SCREEN_BLANK_LINE   (1 << 6)
#define COB_SCREEN_BLANK_LINE   (1 << 6)
#define COB_SCREEN_BLANK_LINE   (1 << 6)
#define COB_SCREEN_BLANK_SCREEN   (1 << 7)
#define COB_SCREEN_BLANK_SCREEN   (1 << 7)
#define COB_SCREEN_BLANK_SCREEN   (1 << 7)
#define COB_SCREEN_BLANK_SCREEN   (1 << 7)
#define COB_SCREEN_BLANK_SCREEN   (1 << 7)
#define COB_SCREEN_BLINK   (1 << 8)
#define COB_SCREEN_BLINK   (1 << 8)
#define COB_SCREEN_BLINK   (1 << 8)
#define COB_SCREEN_BLINK   (1 << 8)
#define COB_SCREEN_BLINK   (1 << 8)
#define COB_SCREEN_BLUE   1
#define COB_SCREEN_BLUE   1
#define COB_SCREEN_BLUE   1
#define COB_SCREEN_BLUE   1
#define COB_SCREEN_BLUE   1
#define COB_SCREEN_COLUMN_MINUS   (1 << 3)
#define COB_SCREEN_COLUMN_MINUS   (1 << 3)
#define COB_SCREEN_COLUMN_MINUS   (1 << 3)
#define COB_SCREEN_COLUMN_MINUS   (1 << 3)
#define COB_SCREEN_COLUMN_MINUS   (1 << 3)
#define COB_SCREEN_COLUMN_PLUS   (1 << 2)
#define COB_SCREEN_COLUMN_PLUS   (1 << 2)
#define COB_SCREEN_COLUMN_PLUS   (1 << 2)
#define COB_SCREEN_COLUMN_PLUS   (1 << 2)
#define COB_SCREEN_COLUMN_PLUS   (1 << 2)
#define COB_SCREEN_CYAN   3
#define COB_SCREEN_CYAN   3
#define COB_SCREEN_CYAN   3
#define COB_SCREEN_CYAN   3
#define COB_SCREEN_CYAN   3
#define COB_SCREEN_EMULATE_NL   (1 << 27)
#define COB_SCREEN_EMULATE_NL   (1 << 27)

Referenced by cob_display().

#define COB_SCREEN_EMULATE_NL   (1 << 27)
#define COB_SCREEN_EMULATE_NL   (1 << 27)
#define COB_SCREEN_EMULATE_NL   (1 << 27)
#define COB_SCREEN_ERASE_EOL   (1 << 9)

Referenced by cb_emit_display().

#define COB_SCREEN_ERASE_EOL   (1 << 9)
#define COB_SCREEN_ERASE_EOL   (1 << 9)
#define COB_SCREEN_ERASE_EOL   (1 << 9)
#define COB_SCREEN_ERASE_EOL   (1 << 9)
#define COB_SCREEN_ERASE_EOS   (1 << 10)
#define COB_SCREEN_ERASE_EOS   (1 << 10)

Referenced by cb_emit_display().

#define COB_SCREEN_ERASE_EOS   (1 << 10)
#define COB_SCREEN_ERASE_EOS   (1 << 10)
#define COB_SCREEN_ERASE_EOS   (1 << 10)
#define COB_SCREEN_FULL   (1 << 11)
#define COB_SCREEN_FULL   (1 << 11)
#define COB_SCREEN_FULL   (1 << 11)
#define COB_SCREEN_FULL   (1 << 11)
#define COB_SCREEN_FULL   (1 << 11)
#define COB_SCREEN_GREEN   2
#define COB_SCREEN_GREEN   2
#define COB_SCREEN_GREEN   2
#define COB_SCREEN_GREEN   2
#define COB_SCREEN_GREEN   2
#define COB_SCREEN_HIGHLIGHT   (1 << 12)
#define COB_SCREEN_HIGHLIGHT   (1 << 12)
#define COB_SCREEN_HIGHLIGHT   (1 << 12)
#define COB_SCREEN_HIGHLIGHT   (1 << 12)
#define COB_SCREEN_HIGHLIGHT   (1 << 12)
#define COB_SCREEN_INITIAL   (1 << 23)
#define COB_SCREEN_INITIAL   (1 << 23)
#define COB_SCREEN_INITIAL   (1 << 23)
#define COB_SCREEN_INITIAL   (1 << 23)
#define COB_SCREEN_INITIAL   (1 << 23)
#define COB_SCREEN_INPUT   (1 << 21)
#define COB_SCREEN_INPUT   (1 << 21)
#define COB_SCREEN_INPUT   (1 << 21)
#define COB_SCREEN_INPUT   (1 << 21)
#define COB_SCREEN_INPUT   (1 << 21)
#define COB_SCREEN_LEFTLINE   (1 << 25)
#define COB_SCREEN_LEFTLINE   (1 << 25)
#define COB_SCREEN_LEFTLINE   (1 << 25)
#define COB_SCREEN_LEFTLINE   (1 << 25)
#define COB_SCREEN_LEFTLINE   (1 << 25)
#define COB_SCREEN_LINE_MINUS   (1 << 1)
#define COB_SCREEN_LINE_MINUS   (1 << 1)
#define COB_SCREEN_LINE_MINUS   (1 << 1)
#define COB_SCREEN_LINE_MINUS   (1 << 1)
#define COB_SCREEN_LINE_MINUS   (1 << 1)
#define COB_SCREEN_LINE_PLUS   (1 << 0)
#define COB_SCREEN_LINE_PLUS   (1 << 0)
#define COB_SCREEN_LINE_PLUS   (1 << 0)
#define COB_SCREEN_LINE_PLUS   (1 << 0)
#define COB_SCREEN_LINE_PLUS   (1 << 0)
#define COB_SCREEN_LOWER   (1 << 29)
#define COB_SCREEN_LOWER   (1 << 29)
#define COB_SCREEN_LOWER   (1 << 29)
#define COB_SCREEN_LOWER   (1 << 29)
#define COB_SCREEN_LOWER   (1 << 29)
#define COB_SCREEN_LOWLIGHT   (1 << 13)
#define COB_SCREEN_LOWLIGHT   (1 << 13)
#define COB_SCREEN_LOWLIGHT   (1 << 13)
#define COB_SCREEN_LOWLIGHT   (1 << 13)
#define COB_SCREEN_LOWLIGHT   (1 << 13)
#define COB_SCREEN_MAGENTA   5
#define COB_SCREEN_MAGENTA   5
#define COB_SCREEN_MAGENTA   5
#define COB_SCREEN_MAGENTA   5
#define COB_SCREEN_MAGENTA   5
#define COB_SCREEN_NO_DISP   (1 << 26)
#define COB_SCREEN_NO_DISP   (1 << 26)

Referenced by cb_emit_display().

#define COB_SCREEN_NO_DISP   (1 << 26)
#define COB_SCREEN_NO_DISP   (1 << 26)
#define COB_SCREEN_NO_DISP   (1 << 26)
#define COB_SCREEN_NO_ECHO   (1 << 24)
#define COB_SCREEN_NO_ECHO   (1 << 24)
#define COB_SCREEN_NO_ECHO   (1 << 24)
#define COB_SCREEN_NO_ECHO   (1 << 24)
#define COB_SCREEN_NO_ECHO   (1 << 24)
#define COB_SCREEN_OVERLINE   (1 << 18)
#define COB_SCREEN_OVERLINE   (1 << 18)
#define COB_SCREEN_OVERLINE   (1 << 18)
#define COB_SCREEN_OVERLINE   (1 << 18)
#define COB_SCREEN_OVERLINE   (1 << 18)
#define COB_SCREEN_PROMPT   (1 << 19)
#define COB_SCREEN_PROMPT   (1 << 19)
#define COB_SCREEN_PROMPT   (1 << 19)
#define COB_SCREEN_PROMPT   (1 << 19)

Referenced by cob_accept().

#define COB_SCREEN_PROMPT   (1 << 19)
#define cob_screen_ptr   cob_screen *
#define cob_screen_ptr   cob_screen *
#define cob_screen_ptr   cob_screen *
#define cob_screen_ptr   cob_screen *
#define cob_screen_ptr   cob_screen *
#define COB_SCREEN_RED   4
#define COB_SCREEN_RED   4
#define COB_SCREEN_RED   4
#define COB_SCREEN_RED   4
#define COB_SCREEN_RED   4
#define COB_SCREEN_REQUIRED   (1 << 14)
#define COB_SCREEN_REQUIRED   (1 << 14)
#define COB_SCREEN_REQUIRED   (1 << 14)
#define COB_SCREEN_REQUIRED   (1 << 14)
#define COB_SCREEN_REQUIRED   (1 << 14)
#define COB_SCREEN_REVERSE   (1 << 15)
#define COB_SCREEN_REVERSE   (1 << 15)
#define COB_SCREEN_REVERSE   (1 << 15)
#define COB_SCREEN_REVERSE   (1 << 15)
#define COB_SCREEN_REVERSE   (1 << 15)
#define COB_SCREEN_SCROLL_DOWN   (1 << 22)
#define COB_SCREEN_SCROLL_DOWN   (1 << 22)
#define COB_SCREEN_SCROLL_DOWN   (1 << 22)
#define COB_SCREEN_SCROLL_DOWN   (1 << 22)
#define COB_SCREEN_SCROLL_DOWN   (1 << 22)
#define COB_SCREEN_SECURE   (1 << 16)
#define COB_SCREEN_SECURE   (1 << 16)
#define COB_SCREEN_SECURE   (1 << 16)
#define COB_SCREEN_SECURE   (1 << 16)
#define COB_SCREEN_SECURE   (1 << 16)
#define COB_SCREEN_TYPE_ATTRIBUTE   3
#define COB_SCREEN_TYPE_ATTRIBUTE   3
#define COB_SCREEN_TYPE_ATTRIBUTE   3
#define COB_SCREEN_TYPE_ATTRIBUTE   3
#define COB_SCREEN_TYPE_ATTRIBUTE   3
#define COB_SCREEN_TYPE_FIELD   1
#define COB_SCREEN_TYPE_FIELD   1
#define COB_SCREEN_TYPE_FIELD   1
#define COB_SCREEN_TYPE_FIELD   1
#define COB_SCREEN_TYPE_GROUP   0
#define COB_SCREEN_TYPE_GROUP   0
#define COB_SCREEN_TYPE_GROUP   0
#define COB_SCREEN_TYPE_GROUP   0
#define COB_SCREEN_TYPE_VALUE   2
#define COB_SCREEN_TYPE_VALUE   2
#define COB_SCREEN_TYPE_VALUE   2
#define COB_SCREEN_TYPE_VALUE   2
#define COB_SCREEN_UNDERLINE   (1 << 17)
#define COB_SCREEN_UNDERLINE   (1 << 17)
#define COB_SCREEN_UNDERLINE   (1 << 17)
#define COB_SCREEN_UNDERLINE   (1 << 17)
#define COB_SCREEN_UNDERLINE   (1 << 17)
#define COB_SCREEN_UPDATE   (1 << 20)
#define COB_SCREEN_UPDATE   (1 << 20)
#define COB_SCREEN_UPDATE   (1 << 20)
#define COB_SCREEN_UPDATE   (1 << 20)
#define COB_SCREEN_UPDATE   (1 << 20)
#define COB_SCREEN_UPPER   (1 << 28)
#define COB_SCREEN_UPPER   (1 << 28)
#define COB_SCREEN_UPPER   (1 << 28)
#define COB_SCREEN_UPPER   (1 << 28)
#define COB_SCREEN_UPPER   (1 << 28)
#define COB_SCREEN_WHITE   7
#define COB_SCREEN_WHITE   7
#define COB_SCREEN_WHITE   7
#define COB_SCREEN_WHITE   7
#define COB_SCREEN_WHITE   7
#define COB_SCREEN_YELLOW   6
#define COB_SCREEN_YELLOW   6
#define COB_SCREEN_YELLOW   6
#define COB_SCREEN_YELLOW   6
#define COB_SCREEN_YELLOW   6
#define COB_SELECT_EXTERNAL   (1U << 1)
#define COB_SELECT_EXTERNAL   (1U << 1)
#define COB_SELECT_EXTERNAL   (1U << 1)
#define COB_SELECT_EXTERNAL   (1U << 1)
#define COB_SELECT_EXTERNAL   (1U << 1)
#define COB_SELECT_FILE_STATUS   (1U << 0)
#define COB_SELECT_FILE_STATUS   (1U << 0)
#define COB_SELECT_FILE_STATUS   (1U << 0)
#define COB_SELECT_FILE_STATUS   (1U << 0)
#define COB_SELECT_FILE_STATUS   (1U << 0)
#define COB_SELECT_LINAGE   (1U << 2)
#define COB_SELECT_LINAGE   (1U << 2)
#define COB_SELECT_LINAGE   (1U << 2)
#define COB_SELECT_LINAGE   (1U << 2)
#define COB_SELECT_SPLITKEY   (1U << 3)
#define COB_SELECT_SPLITKEY   (1U << 3)
#define COB_SELECT_SPLITKEY   (1U << 3)
#define COB_SELECT_SPLITKEY   (1U << 3)
#define COB_SELECT_SPLITKEY   (1U << 3)
#define COB_SELECT_STDIN   (1U << 4)
#define COB_SELECT_STDIN   (1U << 4)
#define COB_SELECT_STDIN   (1U << 4)
#define COB_SELECT_STDIN   (1U << 4)
#define COB_SELECT_STDIN   (1U << 4)
#define COB_SELECT_STDOUT   (1U << 5)
#define COB_SELECT_STDOUT   (1U << 5)
#define COB_SELECT_STDOUT   (1U << 5)
#define COB_SELECT_STDOUT   (1U << 5)
#define COB_SELECT_STDOUT   (1U << 5)
#define COB_SELECT_TEMPORARY   (1U << 6)
#define COB_SELECT_TEMPORARY   (1U << 6)
#define COB_SELECT_TEMPORARY   (1U << 6)
#define COB_SELECT_TEMPORARY   (1U << 6)
#define COB_SELECT_TEMPORARY   (1U << 6)
#define COB_SET_DATA (   x,
 
)    (x.data = z, &x)
#define COB_SET_DATA (   x,
 
)    (x.data = z, &x)
#define COB_SET_DATA (   x,
 
)    (x.data = z, &x)
#define COB_SET_DATA (   x,
 
)    (x.data = z, &x)
#define COB_SET_DATA (   x,
 
)    (x.data = z, &x)
#define COB_SET_FLD (   v,
  x,
  y,
 
)    (v.size = x, v.data = y, v.attr = z, &v)
#define COB_SET_FLD (   v,
  x,
  y,
 
)    (v.size = x, v.data = y, v.attr = z, &v)
#define COB_SET_FLD (   v,
  x,
  y,
 
)    (v.size = x, v.data = y, v.attr = z, &v)
#define COB_SET_FLD (   v,
  x,
  y,
 
)    (v.size = x, v.data = y, v.attr = z, &v)
#define COB_SET_FLD (   v,
  x,
  y,
 
)    (v.size = x, v.data = y, v.attr = z, &v)
#define cob_sli_t   long int
#define cob_sli_t   long int
#define cob_sli_t   long int
#define cob_sli_t   long int
#define COB_SMALL_BUFF   1024
#define COB_SMALL_BUFF   1024
#define COB_SMALL_BUFF   1024
#define COB_SMALL_BUFF   1024
#define COB_SMALL_MAX   (COB_SMALL_BUFF - 1)
#define COB_SMALL_MAX   (COB_SMALL_BUFF - 1)
#define COB_SMALL_MAX   (COB_SMALL_BUFF - 1)
#define COB_SMALL_MAX   (COB_SMALL_BUFF - 1)
#define COB_SORT_CHUNK   256 * 1024
#define COB_SORT_CHUNK   256 * 1024
#define COB_SORT_CHUNK   256 * 1024
#define COB_SORT_CHUNK   256 * 1024
#define COB_SORT_CHUNK   256 * 1024
#define COB_SORT_MEMORY   128 * 1024 * 1024
#define COB_SORT_MEMORY   128 * 1024 * 1024
#define COB_SORT_MEMORY   128 * 1024 * 1024
#define COB_SORT_MEMORY   128 * 1024 * 1024
#define COB_SORT_MEMORY   128 * 1024 * 1024
#define COB_STACK_SIZE   255
#define COB_STACK_SIZE   255
#define COB_STACK_SIZE   255
#define COB_STACK_SIZE   255
#define COB_STACK_SIZE   255
#define COB_STATUS_00_SUCCESS   00
#define COB_STATUS_00_SUCCESS   00
#define COB_STATUS_00_SUCCESS   00
#define COB_STATUS_00_SUCCESS   00
#define COB_STATUS_02_SUCCESS_DUPLICATE   02
#define COB_STATUS_02_SUCCESS_DUPLICATE   02
#define COB_STATUS_02_SUCCESS_DUPLICATE   02
#define COB_STATUS_02_SUCCESS_DUPLICATE   02
#define COB_STATUS_02_SUCCESS_DUPLICATE   02
#define COB_STATUS_04_SUCCESS_INCOMPLETE   04
#define COB_STATUS_04_SUCCESS_INCOMPLETE   04
#define COB_STATUS_04_SUCCESS_INCOMPLETE   04
#define COB_STATUS_04_SUCCESS_INCOMPLETE   04

Referenced by sequential_read().

#define COB_STATUS_04_SUCCESS_INCOMPLETE   04
#define COB_STATUS_05_SUCCESS_OPTIONAL   05
#define COB_STATUS_05_SUCCESS_OPTIONAL   05
#define COB_STATUS_05_SUCCESS_OPTIONAL   05
#define COB_STATUS_05_SUCCESS_OPTIONAL   05
#define COB_STATUS_05_SUCCESS_OPTIONAL   05
#define COB_STATUS_07_SUCCESS_NO_UNIT   07
#define COB_STATUS_07_SUCCESS_NO_UNIT   07
#define COB_STATUS_07_SUCCESS_NO_UNIT   07

Referenced by cob_file_close().

#define COB_STATUS_07_SUCCESS_NO_UNIT   07
#define COB_STATUS_07_SUCCESS_NO_UNIT   07
#define COB_STATUS_10_END_OF_FILE   10
#define COB_STATUS_10_END_OF_FILE   10
#define COB_STATUS_10_END_OF_FILE   10
#define COB_STATUS_10_END_OF_FILE   10
#define COB_STATUS_14_OUT_OF_KEY_RANGE   14
#define COB_STATUS_14_OUT_OF_KEY_RANGE   14
#define COB_STATUS_14_OUT_OF_KEY_RANGE   14
#define COB_STATUS_14_OUT_OF_KEY_RANGE   14
#define COB_STATUS_14_OUT_OF_KEY_RANGE   14
#define COB_STATUS_21_KEY_INVALID   21
#define COB_STATUS_21_KEY_INVALID   21
#define COB_STATUS_21_KEY_INVALID   21
#define COB_STATUS_21_KEY_INVALID   21
#define COB_STATUS_21_KEY_INVALID   21
#define COB_STATUS_22_KEY_EXISTS   22
#define COB_STATUS_22_KEY_EXISTS   22
#define COB_STATUS_22_KEY_EXISTS   22
#define COB_STATUS_22_KEY_EXISTS   22
#define COB_STATUS_22_KEY_EXISTS   22
#define COB_STATUS_23_KEY_NOT_EXISTS   23
#define COB_STATUS_23_KEY_NOT_EXISTS   23
#define COB_STATUS_23_KEY_NOT_EXISTS   23
#define COB_STATUS_23_KEY_NOT_EXISTS   23
#define COB_STATUS_24_KEY_BOUNDARY   24
#define COB_STATUS_24_KEY_BOUNDARY   24
#define COB_STATUS_24_KEY_BOUNDARY   24
#define COB_STATUS_24_KEY_BOUNDARY   24
#define COB_STATUS_24_KEY_BOUNDARY   24
#define COB_STATUS_30_PERMANENT_ERROR   30
#define COB_STATUS_30_PERMANENT_ERROR   30
#define COB_STATUS_30_PERMANENT_ERROR   30
#define COB_STATUS_30_PERMANENT_ERROR   30
#define COB_STATUS_31_INCONSISTENT_FILENAME   31
#define COB_STATUS_31_INCONSISTENT_FILENAME   31
#define COB_STATUS_31_INCONSISTENT_FILENAME   31
#define COB_STATUS_31_INCONSISTENT_FILENAME   31
#define COB_STATUS_31_INCONSISTENT_FILENAME   31
#define COB_STATUS_34_BOUNDARY_VIOLATION   34
#define COB_STATUS_34_BOUNDARY_VIOLATION   34
#define COB_STATUS_34_BOUNDARY_VIOLATION   34
#define COB_STATUS_34_BOUNDARY_VIOLATION   34
#define COB_STATUS_34_BOUNDARY_VIOLATION   34
#define COB_STATUS_35_NOT_EXISTS   35
#define COB_STATUS_35_NOT_EXISTS   35
#define COB_STATUS_35_NOT_EXISTS   35
#define COB_STATUS_35_NOT_EXISTS   35
#define COB_STATUS_35_NOT_EXISTS   35
#define COB_STATUS_37_PERMISSION_DENIED   37
#define COB_STATUS_37_PERMISSION_DENIED   37
#define COB_STATUS_37_PERMISSION_DENIED   37
#define COB_STATUS_37_PERMISSION_DENIED   37
#define COB_STATUS_37_PERMISSION_DENIED   37
#define COB_STATUS_38_CLOSED_WITH_LOCK   38

Referenced by cob_delete_file(), and cob_open().

#define COB_STATUS_38_CLOSED_WITH_LOCK   38
#define COB_STATUS_38_CLOSED_WITH_LOCK   38
#define COB_STATUS_38_CLOSED_WITH_LOCK   38
#define COB_STATUS_38_CLOSED_WITH_LOCK   38
#define COB_STATUS_39_CONFLICT_ATTRIBUTE   39
#define COB_STATUS_39_CONFLICT_ATTRIBUTE   39

Referenced by indexed_open().

#define COB_STATUS_39_CONFLICT_ATTRIBUTE   39
#define COB_STATUS_39_CONFLICT_ATTRIBUTE   39
#define COB_STATUS_39_CONFLICT_ATTRIBUTE   39
#define COB_STATUS_41_ALREADY_OPEN   41
#define COB_STATUS_41_ALREADY_OPEN   41
#define COB_STATUS_41_ALREADY_OPEN   41
#define COB_STATUS_41_ALREADY_OPEN   41
#define COB_STATUS_41_ALREADY_OPEN   41
#define COB_STATUS_42_NOT_OPEN   42
#define COB_STATUS_42_NOT_OPEN   42

Referenced by cob_close(), and cob_fatal_error().

#define COB_STATUS_42_NOT_OPEN   42
#define COB_STATUS_42_NOT_OPEN   42
#define COB_STATUS_42_NOT_OPEN   42
#define COB_STATUS_43_READ_NOT_DONE   43
#define COB_STATUS_43_READ_NOT_DONE   43
#define COB_STATUS_43_READ_NOT_DONE   43
#define COB_STATUS_43_READ_NOT_DONE   43
#define COB_STATUS_43_READ_NOT_DONE   43
#define COB_STATUS_44_RECORD_OVERFLOW   44
#define COB_STATUS_44_RECORD_OVERFLOW   44
#define COB_STATUS_44_RECORD_OVERFLOW   44
#define COB_STATUS_44_RECORD_OVERFLOW   44
#define COB_STATUS_44_RECORD_OVERFLOW   44
#define COB_STATUS_46_READ_ERROR   46
#define COB_STATUS_46_READ_ERROR   46
#define COB_STATUS_46_READ_ERROR   46
#define COB_STATUS_46_READ_ERROR   46
#define COB_STATUS_46_READ_ERROR   46
#define COB_STATUS_47_INPUT_DENIED   47
#define COB_STATUS_47_INPUT_DENIED   47
#define COB_STATUS_47_INPUT_DENIED   47
#define COB_STATUS_47_INPUT_DENIED   47
#define COB_STATUS_47_INPUT_DENIED   47
#define COB_STATUS_48_OUTPUT_DENIED   48
#define COB_STATUS_48_OUTPUT_DENIED   48
#define COB_STATUS_48_OUTPUT_DENIED   48
#define COB_STATUS_48_OUTPUT_DENIED   48
#define COB_STATUS_48_OUTPUT_DENIED   48
#define COB_STATUS_49_I_O_DENIED   49
#define COB_STATUS_49_I_O_DENIED   49
#define COB_STATUS_49_I_O_DENIED   49
#define COB_STATUS_49_I_O_DENIED   49
#define COB_STATUS_49_I_O_DENIED   49
#define COB_STATUS_51_RECORD_LOCKED   51
#define COB_STATUS_51_RECORD_LOCKED   51
#define COB_STATUS_51_RECORD_LOCKED   51
#define COB_STATUS_51_RECORD_LOCKED   51
#define COB_STATUS_51_RECORD_LOCKED   51
#define COB_STATUS_57_I_O_LINAGE   57
#define COB_STATUS_57_I_O_LINAGE   57
#define COB_STATUS_57_I_O_LINAGE   57
#define COB_STATUS_57_I_O_LINAGE   57
#define COB_STATUS_57_I_O_LINAGE   57
#define COB_STATUS_61_FILE_SHARING   61
#define COB_STATUS_61_FILE_SHARING   61
#define COB_STATUS_61_FILE_SHARING   61
#define COB_STATUS_61_FILE_SHARING   61
#define COB_STATUS_61_FILE_SHARING   61
#define COB_STATUS_91_NOT_AVAILABLE   91
#define COB_STATUS_91_NOT_AVAILABLE   91
#define COB_STATUS_91_NOT_AVAILABLE   91
#define COB_STATUS_91_NOT_AVAILABLE   91
#define COB_STORE_AWAY_FROM_ZERO   (1 << 4)
#define COB_STORE_AWAY_FROM_ZERO   (1 << 4)

Referenced by cob_decimal_do_round().

#define COB_STORE_AWAY_FROM_ZERO   (1 << 4)
#define COB_STORE_AWAY_FROM_ZERO   (1 << 4)
#define COB_STORE_AWAY_FROM_ZERO   (1 << 4)
#define COB_STORE_KEEP_ON_OVERFLOW   (1 << 1)
#define COB_STORE_KEEP_ON_OVERFLOW   (1 << 1)
#define COB_STORE_KEEP_ON_OVERFLOW   (1 << 1)
#define COB_STORE_KEEP_ON_OVERFLOW   (1 << 1)
#define COB_STORE_KEEP_ON_OVERFLOW   (1 << 1)
#define COB_STORE_MASK
Value:
COB_STORE_TRUNC_ON_OVERFLOW)

Referenced by cob_decimal_do_round().

#define COB_STORE_MASK
Value:
COB_STORE_TRUNC_ON_OVERFLOW)
#define COB_STORE_MASK
Value:
COB_STORE_TRUNC_ON_OVERFLOW)
#define COB_STORE_MASK
Value:
COB_STORE_TRUNC_ON_OVERFLOW)
#define COB_STORE_MASK
Value:
COB_STORE_TRUNC_ON_OVERFLOW)
#define COB_STORE_NEAR_AWAY_FROM_ZERO   (1 << 5)
#define COB_STORE_NEAR_AWAY_FROM_ZERO   (1 << 5)
#define COB_STORE_NEAR_AWAY_FROM_ZERO   (1 << 5)
#define COB_STORE_NEAR_AWAY_FROM_ZERO   (1 << 5)

Referenced by cob_decimal_do_round().

#define COB_STORE_NEAR_AWAY_FROM_ZERO   (1 << 5)
#define COB_STORE_NEAR_EVEN   (1 << 6)
#define COB_STORE_NEAR_EVEN   (1 << 6)

Referenced by cob_decimal_do_round().

#define COB_STORE_NEAR_EVEN   (1 << 6)
#define COB_STORE_NEAR_EVEN   (1 << 6)
#define COB_STORE_NEAR_EVEN   (1 << 6)
#define COB_STORE_NEAR_TOWARD_ZERO   (1 << 7)

Referenced by cob_decimal_do_round().

#define COB_STORE_NEAR_TOWARD_ZERO   (1 << 7)
#define COB_STORE_NEAR_TOWARD_ZERO   (1 << 7)
#define COB_STORE_NEAR_TOWARD_ZERO   (1 << 7)
#define COB_STORE_NEAR_TOWARD_ZERO   (1 << 7)
#define COB_STORE_PROHIBITED   (1 << 8)

Referenced by cob_decimal_do_round().

#define COB_STORE_PROHIBITED   (1 << 8)
#define COB_STORE_PROHIBITED   (1 << 8)
#define COB_STORE_PROHIBITED   (1 << 8)
#define COB_STORE_PROHIBITED   (1 << 8)
#define COB_STORE_ROUND   (1 << 0)

Referenced by cob_decimal_get_field().

#define COB_STORE_ROUND   (1 << 0)
#define COB_STORE_ROUND   (1 << 0)
#define COB_STORE_ROUND   (1 << 0)
#define COB_STORE_ROUND   (1 << 0)
#define COB_STORE_TOWARD_GREATER   (1 << 9)

Referenced by cob_decimal_do_round().

#define COB_STORE_TOWARD_GREATER   (1 << 9)
#define COB_STORE_TOWARD_GREATER   (1 << 9)
#define COB_STORE_TOWARD_GREATER   (1 << 9)
#define COB_STORE_TOWARD_GREATER   (1 << 9)
#define COB_STORE_TOWARD_LESSER   (1 << 10)

Referenced by cob_decimal_do_round().

#define COB_STORE_TOWARD_LESSER   (1 << 10)
#define COB_STORE_TOWARD_LESSER   (1 << 10)
#define COB_STORE_TOWARD_LESSER   (1 << 10)
#define COB_STORE_TOWARD_LESSER   (1 << 10)
#define COB_STORE_TRUNC_ON_OVERFLOW   (1 << 2)
#define COB_STORE_TRUNC_ON_OVERFLOW   (1 << 2)
#define COB_STORE_TRUNC_ON_OVERFLOW   (1 << 2)
#define COB_STORE_TRUNC_ON_OVERFLOW   (1 << 2)
#define COB_STORE_TRUNC_ON_OVERFLOW   (1 << 2)
#define COB_STORE_TRUNCATION   (1 << 11)

Referenced by cob_decimal_do_round().

#define COB_STORE_TRUNCATION   (1 << 11)
#define COB_STORE_TRUNCATION   (1 << 11)
#define COB_STORE_TRUNCATION   (1 << 11)
#define COB_STORE_TRUNCATION   (1 << 11)
#define COB_TYPE_ALPHANUMERIC   0x21U
#define COB_TYPE_ALPHANUMERIC   0x21U
#define COB_TYPE_ALPHANUMERIC   0x21U
#define COB_TYPE_ALPHANUMERIC   0x21U
#define COB_TYPE_ALPHANUMERIC_ALL   0x22U
#define COB_TYPE_ALPHANUMERIC_ALL   0x22U
#define COB_TYPE_ALPHANUMERIC_ALL   0x22U
#define COB_TYPE_ALPHANUMERIC_ALL   0x22U
#define COB_TYPE_ALPHANUMERIC_ALL   0x22U
#define COB_TYPE_ALPHANUMERIC_EDITED   0x23U
#define COB_TYPE_ALPHANUMERIC_EDITED   0x23U
#define COB_TYPE_ALPHANUMERIC_EDITED   0x23U
#define COB_TYPE_ALPHANUMERIC_EDITED   0x23U
#define COB_TYPE_ALPHANUMERIC_EDITED   0x23U
#define COB_TYPE_BOOLEAN   0x02U
#define COB_TYPE_BOOLEAN   0x02U
#define COB_TYPE_BOOLEAN   0x02U
#define COB_TYPE_BOOLEAN   0x02U
#define COB_TYPE_BOOLEAN   0x02U
#define COB_TYPE_GROUP   0x01U
#define COB_TYPE_GROUP   0x01U
#define COB_TYPE_GROUP   0x01U
#define COB_TYPE_GROUP   0x01U
#define COB_TYPE_GROUP   0x01U

Referenced by cb_tree_type(), cob_move(), and output_attr().

#define COB_TYPE_NATIONAL   0x40U
#define COB_TYPE_NATIONAL   0x40U
#define COB_TYPE_NATIONAL   0x40U
#define COB_TYPE_NATIONAL   0x40U
#define COB_TYPE_NATIONAL   0x40U
#define COB_TYPE_NATIONAL_EDITED   0x41U
#define COB_TYPE_NATIONAL_EDITED   0x41U
#define COB_TYPE_NATIONAL_EDITED   0x41U
#define COB_TYPE_NATIONAL_EDITED   0x41U
#define COB_TYPE_NATIONAL_EDITED   0x41U
#define COB_TYPE_NUMERIC   0x10U
#define COB_TYPE_NUMERIC   0x10U
#define COB_TYPE_NUMERIC   0x10U
#define COB_TYPE_NUMERIC   0x10U
#define COB_TYPE_NUMERIC   0x10U
#define COB_TYPE_NUMERIC_BINARY   0x11U
#define COB_TYPE_NUMERIC_BINARY   0x11U
#define COB_TYPE_NUMERIC_BINARY   0x11U
#define COB_TYPE_NUMERIC_BINARY   0x11U
#define COB_TYPE_NUMERIC_DISPLAY   0x10U
#define COB_TYPE_NUMERIC_DISPLAY   0x10U
#define COB_TYPE_NUMERIC_DISPLAY   0x10U
#define COB_TYPE_NUMERIC_DISPLAY   0x10U
#define COB_TYPE_NUMERIC_DOUBLE   0x14U
#define COB_TYPE_NUMERIC_DOUBLE   0x14U
#define COB_TYPE_NUMERIC_DOUBLE   0x14U
#define COB_TYPE_NUMERIC_DOUBLE   0x14U
#define COB_TYPE_NUMERIC_EDITED   0x24U
#define COB_TYPE_NUMERIC_EDITED   0x24U
#define COB_TYPE_NUMERIC_EDITED   0x24U
#define COB_TYPE_NUMERIC_EDITED   0x24U
#define COB_TYPE_NUMERIC_FLOAT   0x13U
#define COB_TYPE_NUMERIC_FLOAT   0x13U
#define COB_TYPE_NUMERIC_FLOAT   0x13U
#define COB_TYPE_NUMERIC_FLOAT   0x13U
#define COB_TYPE_NUMERIC_FP_BIN128   0x1AU
#define COB_TYPE_NUMERIC_FP_BIN128   0x1AU
#define COB_TYPE_NUMERIC_FP_BIN128   0x1AU
#define COB_TYPE_NUMERIC_FP_BIN128   0x1AU

Referenced by cb_tree_type(), cob_add_int(), and cob_move().

#define COB_TYPE_NUMERIC_FP_BIN128   0x1AU
#define COB_TYPE_NUMERIC_FP_BIN32   0x18U
#define COB_TYPE_NUMERIC_FP_BIN32   0x18U

Referenced by cb_tree_type(), and cob_move().

#define COB_TYPE_NUMERIC_FP_BIN32   0x18U
#define COB_TYPE_NUMERIC_FP_BIN32   0x18U
#define COB_TYPE_NUMERIC_FP_BIN32   0x18U
#define COB_TYPE_NUMERIC_FP_BIN64   0x19U
#define COB_TYPE_NUMERIC_FP_BIN64   0x19U
#define COB_TYPE_NUMERIC_FP_BIN64   0x19U
#define COB_TYPE_NUMERIC_FP_BIN64   0x19U
#define COB_TYPE_NUMERIC_FP_BIN64   0x19U

Referenced by cb_tree_type(), and cob_move().

#define COB_TYPE_NUMERIC_FP_DEC128   0x17U
#define COB_TYPE_NUMERIC_FP_DEC128   0x17U
#define COB_TYPE_NUMERIC_FP_DEC128   0x17U
#define COB_TYPE_NUMERIC_FP_DEC128   0x17U
#define COB_TYPE_NUMERIC_FP_DEC64   0x16U
#define COB_TYPE_NUMERIC_FP_DEC64   0x16U
#define COB_TYPE_NUMERIC_FP_DEC64   0x16U
#define COB_TYPE_NUMERIC_FP_DEC64   0x16U
#define COB_TYPE_NUMERIC_L_DOUBLE   0x15U
#define COB_TYPE_NUMERIC_L_DOUBLE   0x15U
#define COB_TYPE_NUMERIC_L_DOUBLE   0x15U
#define COB_TYPE_NUMERIC_L_DOUBLE   0x15U

Referenced by cb_tree_type(), and cob_move().

#define COB_TYPE_NUMERIC_L_DOUBLE   0x15U
#define COB_TYPE_NUMERIC_PACKED   0x12U
#define COB_TYPE_NUMERIC_PACKED   0x12U
#define COB_TYPE_NUMERIC_PACKED   0x12U
#define COB_TYPE_NUMERIC_PACKED   0x12U
#define COB_TYPE_UNKNOWN   0x00
#define COB_TYPE_UNKNOWN   0x00
#define COB_TYPE_UNKNOWN   0x00
#define COB_TYPE_UNKNOWN   0x00
#define COB_TYPE_UNKNOWN   0x00
#define cob_u16_ptr   cob_u16_t *
#define cob_u16_ptr   cob_u16_t *
#define cob_u16_ptr   cob_u16_t *
#define cob_u16_ptr   cob_u16_t *
#define cob_u16_ptr   cob_u16_t *
#define cob_u16_t   unsigned short
#define cob_u16_t   unsigned short
#define cob_u16_t   unsigned short
#define cob_u16_t   unsigned short

Referenced by cob_alloc_set_field_int().

#define cob_u16_t   unsigned short
#define cob_u32_ptr   cob_u32_t *
#define cob_u32_ptr   cob_u32_t *
#define cob_u32_ptr   cob_u32_t *
#define cob_u32_ptr   cob_u32_t *
#define cob_u32_ptr   cob_u32_t *
#define cob_u32_t   unsigned int
#define cob_u32_t   unsigned int
#define cob_u32_t   unsigned int
#define cob_u32_t   unsigned int
#define COB_U64_C (   x)    x ## ULL
#define COB_U64_C (   x)    x ## ULL
#define COB_U64_C (   x)    x ## ULL
#define COB_U64_C (   x)    x ## ULL
#define COB_U64_C (   x)    x ## ULL
#define cob_u64_ptr   cob_u64_t *
#define cob_u64_ptr   cob_u64_t *
#define cob_u64_ptr   cob_u64_t *
#define cob_u64_ptr   cob_u64_t *
#define cob_u64_ptr   cob_u64_t *
#define cob_u64_t   unsigned long long
#define cob_u64_t   unsigned long long
#define cob_u64_t   unsigned long long
#define cob_u64_t   unsigned long long
#define cob_u8_ptr   cob_u8_t *
#define cob_u8_ptr   cob_u8_t *
#define cob_u8_ptr   cob_u8_t *
#define cob_u8_ptr   cob_u8_t *
#define cob_u8_t   unsigned char
#define cob_u8_t   unsigned char
#define cob_u8_t   unsigned char
#define cob_u8_t   unsigned char
#define cob_uli_t   unsigned long int
#define cob_uli_t   unsigned long int
#define cob_uli_t   unsigned long int
#define cob_uli_t   unsigned long int
#define COB_UNUSED (   z)    do { (void)(z); } while (0)
#define COB_UNUSED (   z)    do { (void)(z); } while (0)
#define COB_UNUSED (   z)    do { (void)(z); } while (0)
#define COB_UNUSED (   z)    do { (void)(z); } while (0)
#define cob_void_ptr   void *
#define cob_void_ptr   void *
#define cob_void_ptr   void *
#define cob_void_ptr   void *
#define cob_void_ptr   void *
#define COB_WRITE_AFTER   0x00100000
#define COB_WRITE_AFTER   0x00100000
#define COB_WRITE_AFTER   0x00100000
#define COB_WRITE_AFTER   0x00100000
#define COB_WRITE_BEFORE   0x00200000
#define COB_WRITE_BEFORE   0x00200000
#define COB_WRITE_BEFORE   0x00200000
#define COB_WRITE_BEFORE   0x00200000
#define COB_WRITE_CHANNEL   0x00040000
#define COB_WRITE_CHANNEL   0x00040000
#define COB_WRITE_CHANNEL   0x00040000
#define COB_WRITE_CHANNEL   0x00040000
#define COB_WRITE_CHANNEL   0x00040000
#define COB_WRITE_EOP   0x00400000
#define COB_WRITE_EOP   0x00400000
#define COB_WRITE_EOP   0x00400000
#define COB_WRITE_EOP   0x00400000
#define COB_WRITE_EOP   0x00400000
#define COB_WRITE_LINES   0x00010000
#define COB_WRITE_LINES   0x00010000
#define COB_WRITE_LINES   0x00010000
#define COB_WRITE_LINES   0x00010000
#define COB_WRITE_LOCK   0x00800000
#define COB_WRITE_LOCK   0x00800000
#define COB_WRITE_LOCK   0x00800000
#define COB_WRITE_LOCK   0x00800000

Referenced by cb_emit_rewrite(), and cb_emit_write().

#define COB_WRITE_LOCK   0x00800000
#define COB_WRITE_MASK   0x0000FFFF
#define COB_WRITE_MASK   0x0000FFFF
#define COB_WRITE_MASK   0x0000FFFF
#define COB_WRITE_MASK   0x0000FFFF
#define COB_WRITE_MASK   0x0000FFFF
#define COB_WRITE_NO_LOCK   0x01000000
#define COB_WRITE_NO_LOCK   0x01000000
#define COB_WRITE_NO_LOCK   0x01000000
#define COB_WRITE_NO_LOCK   0x01000000
#define COB_WRITE_NO_LOCK   0x01000000
#define COB_WRITE_PAGE   0x00020000
#define COB_WRITE_PAGE   0x00020000
#define COB_WRITE_PAGE   0x00020000
#define COB_WRITE_PAGE   0x00020000
#define cobcall (   x,
  y,
 
)    cob_call (x, y, z)
#define cobcall (   x,
  y,
 
)    cob_call (x, y, z)
#define cobcall (   x,
  y,
 
)    cob_call (x, y, z)
#define cobcall (   x,
  y,
 
)    cob_call (x, y, z)
#define cobcall (   x,
  y,
 
)    cob_call (x, y, z)
#define cobcancel (   x)    cob_cancel (x)
#define cobcancel (   x)    cob_cancel (x)
#define cobcancel (   x)    cob_cancel (x)
#define cobcancel (   x)    cob_cancel (x)
#define cobcancel (   x)    cob_cancel (x)
#define cobcommandline (   v,
  w,
  x,
  y,
 
)    cob_command_line (v,w,x,y,z)
#define cobcommandline (   v,
  w,
  x,
  y,
 
)    cob_command_line (v,w,x,y,z)
#define cobcommandline (   v,
  w,
  x,
  y,
 
)    cob_command_line (v,w,x,y,z)
#define cobcommandline (   v,
  w,
  x,
  y,
 
)    cob_command_line (v,w,x,y,z)
#define cobcommandline (   v,
  w,
  x,
  y,
 
)    cob_command_line (v,w,x,y,z)
#define cobexit (   x)    cob_stop_run (x)
#define cobexit (   x)    cob_stop_run (x)
#define cobexit (   x)    cob_stop_run (x)
#define cobexit (   x)    cob_stop_run (x)
#define cobexit (   x)    cob_stop_run (x)
#define cobfunc (   x,
  y,
 
)    cob_func (x, y, z)
#define cobfunc (   x,
  y,
 
)    cob_func (x, y, z)
#define cobfunc (   x,
  y,
 
)    cob_func (x, y, z)
#define cobfunc (   x,
  y,
 
)    cob_func (x, y, z)
#define cobfunc (   x,
  y,
 
)    cob_func (x, y, z)
#define cobgetenv (   x)    cob_getenv (x)
#define cobgetenv (   x)    cob_getenv (x)
#define cobgetenv (   x)    cob_getenv (x)
#define cobgetenv (   x)    cob_getenv (x)
#define cobgetenv (   x)    cob_getenv (x)
#define cobinit ( )    cob_extern_init ()
#define cobinit ( )    cob_extern_init ()
#define cobinit ( )    cob_extern_init ()
#define cobinit ( )    cob_extern_init ()
#define cobinit ( )    cob_extern_init ()
#define coblongjmp (   x)    cob_longjmp (x)
#define coblongjmp (   x)    cob_longjmp (x)
#define coblongjmp (   x)    cob_longjmp (x)
#define coblongjmp (   x)    cob_longjmp (x)
#define coblongjmp (   x)    cob_longjmp (x)
#define cobputenv (   x)    cob_putenv (x)
#define cobputenv (   x)    cob_putenv (x)
#define cobputenv (   x)    cob_putenv (x)
#define cobputenv (   x)    cob_putenv (x)
#define cobputenv (   x)    cob_putenv (x)
#define cobsavenv (   x)    cob_savenv (x)
#define cobsavenv (   x)    cob_savenv (x)
#define cobsavenv (   x)    cob_savenv (x)
#define cobsavenv (   x)    cob_savenv (x)
#define cobsavenv (   x)    cob_savenv (x)
#define cobsavenv2 (   x,
 
)    cob_savenv2 (x, z)
#define cobsavenv2 (   x,
 
)    cob_savenv2 (x, z)
#define cobsavenv2 (   x,
 
)    cob_savenv2 (x, z)
#define cobsavenv2 (   x,
 
)    cob_savenv2 (x, z)
#define cobsavenv2 (   x,
 
)    cob_savenv2 (x, z)
#define cobsetjmp (   x)    setjmp (cob_savenv (x))
#define cobsetjmp (   x)    setjmp (cob_savenv (x))
#define cobsetjmp (   x)    setjmp (cob_savenv (x))
#define cobsetjmp (   x)    setjmp (cob_savenv (x))
#define cobsetjmp (   x)    setjmp (cob_savenv (x))
#define cobtidy ( )    cob_tidy ()
#define cobtidy ( )    cob_tidy ()
#define cobtidy ( )    cob_tidy ()
#define cobtidy ( )    cob_tidy ()
#define cobtidy ( )    cob_tidy ()
#define DECLNORET
#define DECLNORET
#define DECLNORET
#define DECLNORET
#define DECLNORET
#define likely (   x)    (x)
#define likely (   x)    (x)
#define likely (   x)    (x)
#define likely (   x)    (x)
#define MAX_FD_RECORD   65535
#define MAX_FD_RECORD   65535
#define MAX_FD_RECORD   65535
#define MAX_FD_RECORD   65535
#define MAX_FD_RECORD   65535

Referenced by finalize_file().

#define optim_memcpy (   x,
  y,
 
)    memcpy (x, y, z)
#define optim_memcpy (   x,
  y,
 
)    memcpy (x, y, z)
#define optim_memcpy (   x,
  y,
 
)    memcpy (x, y, z)
#define optim_memcpy (   x,
  y,
 
)    memcpy (x, y, z)
#define optim_memcpy (   x,
  y,
 
)    memcpy (x, y, z)
#define PATHSEPC   ':'
#define PATHSEPC   ':'
#define PATHSEPC   ':'
#define PATHSEPC   ':'

Referenced by cob_set_library_path().

#define PATHSEPC   ':'
#define PATHSEPS   ":"
#define PATHSEPS   ":"
#define PATHSEPS   ":"
#define PATHSEPS   ":"
#define SLASH_INT   '/'
#define SLASH_INT   '/'
#define SLASH_INT   '/'
#define SLASH_INT   '/'
#define SLASH_INT   '/'

Referenced by cob_temp_name().

#define SLASH_STR   "/"
#define SLASH_STR   "/"
#define SLASH_STR   "/"
#define SLASH_STR   "/"
#define unlikely (   x)    (x)

Referenced by cb_build_intrinsic(), cb_encode_program_id(), cob_accept(), cob_add_int(), cob_alloc_field(), cob_call(), cob_call_field(), cob_cancel(), cob_cancel_field(), cob_check_numdisp(), cob_chk_file_env(), cob_chk_file_mapping(), cob_close(), cob_cmp_numdisp(), cob_copy_check(), cob_correct_numeric(), cob_decimal_div(), cob_decimal_get_binary(), cob_decimal_get_display(), cob_decimal_get_double(), cob_decimal_get_field(), cob_decimal_get_packed(), cob_decimal_pow(), cob_decimal_print(), cob_decimal_set_display(), cob_decimal_set_packed(), cob_delete(), cob_delete_file(), cob_display(), cob_display_environment(), cob_fast_malloc(), cob_field_to_string(), cob_file_open(), cob_file_sort_compare(), cob_file_sort_process(), cob_file_sort_retrieve(), cob_file_sort_submit(), cob_file_write_opt(), cob_free(), cob_get_environment(), cob_get_global_ptr(), cob_inspect_converting(), cob_inspect_finish(), cob_inspect_init(), cob_intr_concatenate(), cob_intr_current_date(), cob_intr_formatted_date(), cob_intr_formatted_datetime(), cob_intr_formatted_time(), cob_intr_lcl_time_from_secs(), cob_intr_locale_date(), cob_intr_locale_time(), cob_intr_lower_case(), cob_intr_reverse(), cob_intr_substitute(), cob_intr_substitute_case(), cob_intr_trim(), cob_intr_upper_case(), cob_intr_when_compiled(), cob_linage_write_opt(), cob_longjmp(), cob_malloc(), cob_module_enter(), cob_move(), cob_move_display_to_alphanum(), cob_new_item(), cob_open(), cob_read(), cob_read_item(), cob_read_next(), cob_real_get_sign(), cob_real_put_sign(), cob_resolve_cobol(), cob_resolve_func(), cob_resolve_internal(), cob_rewrite(), cob_save_func(), cob_savenv(), cob_start(), cob_sys_system(), cob_write(), cob_write_block(), cobc_check_string(), cobc_clean_up(), cobc_free(), cobc_main_malloc(), cobc_main_realloc(), cobc_main_strdup(), cobc_malloc(), cobc_parse_malloc(), cobc_parse_realloc(), cobc_parse_strdup(), cobc_plex_malloc(), cobc_plex_strdup(), cobc_realloc(), cobc_stradd_dup(), cobc_strdup(), common_cmpc(), common_cmps(), indexed_read(), indexed_read_next(), indexed_write(), inspect_common(), lineseq_read(), lineseq_write(), lookup_intrinsic(), lookup_reserved_word(), output(), output_entry_function(), output_stmt(), ppinput(), preprocess(), process(), process_translate(), relative_read(), relative_read_next(), relative_write(), save_status(), scan_numeric(), sequential_read(), sequential_write(), sort_cmps(), store_common_region(), and while().

#define unlikely (   x)    (x)
#define unlikely (   x)    (x)
#define unlikely (   x)    (x)
#define unlikely (   x)    (x)

Typedef Documentation

typedef struct __cob_global cob_global
typedef struct __cob_module cob_module
typedef struct __cob_screen cob_screen

Enumeration Type Documentation

Enumerator
COB_EC_ZERO 
COB_EXCEPTION 
667  {
668  COB_EC_ZERO = 0,
669 #include <libcob/exception.def>
670  COB_EC_MAX
671 };

Function Documentation

COB_EXPIMP void cob_accept ( cob_field )

References cob_field::attr, COB_EC_IMP_ACCEPT, cob_field_accept(), COB_FIELD_IS_NUMERIC, COB_FIELD_TYPE, COB_MEDIUM_MAX, COB_MODULE_PTR, cob_move(), __cob_global::cob_screen_initialized, COB_SCREEN_PROMPT, cob_set_exception(), cob_set_int(), COB_TERM_BUFF, COB_TYPE_NUMERIC_DISPLAY, const_alpha_attr, cob_field::data, NULL, p, cob_field::size, and unlikely.

283 {
284  unsigned char *p;
285  size_t size;
286  int ipchr;
287  cob_field temp;
288 
292  return;
293  }
294  if (COB_MODULE_PTR->crt_status) {
295  if (COB_FIELD_IS_NUMERIC (COB_MODULE_PTR->crt_status)) {
296  cob_set_int (COB_MODULE_PTR->crt_status, 0);
297  } else {
298  memset (COB_MODULE_PTR->crt_status->data, '0', (size_t)4);
299  }
300  }
301  /* extension: ACCEPT OMITTED */
302  if (unlikely(!f)) {
303  for (; ; ) {
304  ipchr = getchar ();
305  if (ipchr == '\n' || ipchr == EOF) {
306  break;
307  }
308  }
309  return;
310  }
311  p = COB_TERM_BUFF;
312  temp.data = p;
313  temp.attr = &const_alpha_attr;
314  size = 0;
315  /* Read a line */
316  for (; size < COB_MEDIUM_MAX; ) {
317  ipchr = getchar ();
318  if (unlikely(ipchr == EOF)) {
320  if (!size) {
321  size = 1;
322  p[0] = ' ';
323  p[1] = 0;
324  }
325  break;
326  } else if (ipchr == '\n') {
327  break;
328  }
329  p[size++] = (char) ipchr;
330  }
331  temp.size = size;
333  if (temp.size > f->size) {
334  temp.size = f->size;
335  }
336  }
337  cob_move (&temp, f);
338 }
COB_EXPIMP void cob_accept_arg_number ( cob_field )

References cob_field::attr, cob_argc, COB_ATTR_INIT, cob_move(), COB_TYPE_NUMERIC_BINARY, cob_field::data, NULL, and cob_field::size.

2590 {
2591  int n;
2592  cob_field_attr attr;
2593  cob_field temp;
2594 
2595  n = cob_argc - 1;
2596  temp.size = 4;
2597  temp.data = (unsigned char *)&n;
2598  temp.attr = &attr;
2599  COB_ATTR_INIT (COB_TYPE_NUMERIC_BINARY, 9, 0, 0, NULL);
2600  cob_move (&temp, f);
2601 }
COB_EXPIMP void cob_accept_arg_value ( cob_field )

References cob_argc, cob_argv, COB_EC_IMP_ACCEPT, cob_memcpy(), cob_set_exception(), and current_arg.

2605 {
2606  if (current_arg >= cob_argc) {
2608  return;
2609  }
2611  strlen (cob_argv[current_arg]));
2612  current_arg++;
2613 }
COB_EXPIMP void cob_accept_command_line ( cob_field )

References cob_argc, cob_argv, cob_free(), cob_malloc(), cob_memcpy(), commlncnt, commlnptr, and cob_field::size.

2526 {
2527  char *buff;
2528  size_t i;
2529  size_t size;
2530  size_t len;
2531 
2532  if (commlncnt) {
2534  return;
2535  }
2536 
2537  if (cob_argc <= 1) {
2538  cob_memcpy (f, " ", (size_t)1);
2539  return;
2540  }
2541 
2542  size = 0;
2543  for (i = 1; i < (size_t)cob_argc; ++i) {
2544  size += (strlen (cob_argv[i]) + 1);
2545  if (size > f->size) {
2546  break;
2547  }
2548  }
2549  buff = cob_malloc (size);
2550  buff[0] = ' ';
2551  size = 0;
2552  for (i = 1; i < (size_t)cob_argc; ++i) {
2553  len = strlen (cob_argv[i]);
2554  memcpy (buff + size, cob_argv[i], len);
2555  size += len;
2556  if (i != (size_t)cob_argc - 1U) {
2557  buff[size++] = ' ';
2558  }
2559  if (size > f->size) {
2560  break;
2561  }
2562  }
2563  cob_memcpy (f, buff, size);
2564  cob_free (buff);
2565 }
COB_EXPIMP void cob_accept_date ( cob_field )

References cob_memcpy(), and NULL.

2414 {
2415  time_t t;
2416  char s[8];
2417 
2418  t = time (NULL);
2419  strftime (s, (size_t)7, "%y%m%d", localtime (&t));
2420  cob_memcpy (f, s, (size_t)6);
2421 }
COB_EXPIMP void cob_accept_date_yyyymmdd ( cob_field )

References cob_memcpy(), and NULL.

2425 {
2426  time_t t;
2427  char s[12];
2428 
2429  t = time (NULL);
2430  strftime (s, (size_t)9, "%Y%m%d", localtime (&t));
2431  cob_memcpy (f, s, (size_t)8);
2432 }
COB_EXPIMP void cob_accept_day ( cob_field )

References cob_memcpy(), and NULL.

2436 {
2437  time_t t;
2438  char s[8];
2439 
2440  t = time (NULL);
2441  strftime (s, (size_t)6, "%y%j", localtime (&t));
2442  cob_memcpy (f, s, (size_t)5);
2443 }
COB_EXPIMP void cob_accept_day_of_week ( cob_field )

References cob_memcpy(), and NULL.

2458 {
2459  struct tm *tm;
2460  time_t t;
2461  unsigned char s[4];
2462 
2463  t = time (NULL);
2464  tm = localtime (&t);
2465  if (tm->tm_wday == 0) {
2466  s[0] = (unsigned char)'7';
2467  } else {
2468  s[0] = (unsigned char)(tm->tm_wday + '0');
2469  }
2470  cob_memcpy (f, s, (size_t)1);
2471 }
COB_EXPIMP void cob_accept_day_yyyyddd ( cob_field )

References cob_memcpy(), and NULL.

2447 {
2448  time_t t;
2449  char s[12];
2450 
2451  t = time (NULL);
2452  strftime (s, (size_t)8, "%Y%j", localtime (&t));
2453  cob_memcpy (f, s, (size_t)7);
2454 }
COB_EXPIMP void cob_accept_environment ( cob_field )

References COB_EC_IMP_ACCEPT, cob_local_env, cob_memcpy(), cob_set_exception(), NULL, and p.

2715 {
2716  const char *p = NULL;
2717 
2718  if (cob_local_env) {
2719  p = getenv (cob_local_env);
2720  }
2721  if (!p) {
2723  p = " ";
2724  }
2725  cob_memcpy (f, p, strlen (p));
2726 }
COB_EXPIMP void cob_accept_escape_key ( cob_field )

References COB_ACCEPT_STATUS, and cob_set_int().

1777 {
1779 }
COB_EXPIMP void cob_accept_exception_status ( cob_field )
COB_EXPIMP void cob_accept_time ( cob_field )

References cob_memcpy(), and NULL.

2475 {
2476 #ifdef _WIN32
2477  SYSTEMTIME syst;
2478 #else
2479  struct tm *tlt;
2480  time_t t;
2481 #if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
2482  struct timeval tmv;
2483  char buff2[8];
2484 #endif
2485 #endif
2486  char s[12];
2487 
2488 #ifdef _WIN32
2489  GetLocalTime (&syst);
2490  sprintf (s, "%2.2d%2.2d%2.2d%2.2d", syst.wHour, syst.wMinute,
2491  syst.wSecond, syst.wMilliseconds / 10);
2492 #else
2493 #if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
2494  gettimeofday (&tmv, NULL);
2495  t = tmv.tv_sec;
2496 #else
2497  t = time (NULL);
2498 #endif
2499  tlt = localtime (&t);
2500  /* Leap seconds ? */
2501  if (tlt->tm_sec >= 60) {
2502  tlt->tm_sec = 59;
2503  }
2504  strftime (s, (size_t)9, "%H%M%S00", tlt);
2505 #if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
2506  sprintf(buff2, "%2.2ld", (long int)(tmv.tv_usec / 10000));
2507  memcpy (&s[6], buff2, (size_t)2);
2508 #endif
2509 #endif
2510  cob_memcpy (f, s, (size_t)8);
2511 }
COB_EXPIMP void cob_accept_user_name ( cob_field )

References cob_memcpy(), and cob_user_name.

1112 {
1113  if (cob_user_name) {
1115  strlen (cob_user_name));
1116  } else {
1117  cob_memcpy (f, " ", (size_t)1);
1118  }
1119 }
COB_EXPIMP void cob_add ( cob_field ,
cob_field ,
const int   
)

References cob_decimal_add(), cob_decimal_get_field(), and cob_decimal_set_field().

1932 {
1936  (void)cob_decimal_get_field (&cob_d1, f1, opt);
1937 }
COB_EXPIMP int cob_add_int ( cob_field ,
const int  ,
const int   
)

References cob_decimal_get_field(), cob_decimal_set_field(), COB_FIELD_SCALE, COB_FIELD_TYPE, cob_mexp, cob_sli_t, COB_TYPE_NUMERIC_DISPLAY, COB_TYPE_NUMERIC_FLOAT, COB_TYPE_NUMERIC_FP_BIN128, COB_TYPE_NUMERIC_PACKED, cob_uli_t, cob_decimal::scale, unlikely, and cob_decimal::value.

2196 {
2197  int scale;
2198  int val;
2199 
2200  if (unlikely(n == 0)) {
2201  return 0;
2202  }
2203 #if 0 /* RXWRXW - Buggy */
2204  if (COB_FIELD_TYPE (f) == COB_TYPE_NUMERIC_PACKED) {
2205  return cob_add_packed (f, n, opt);
2206  } else if (COB_FIELD_TYPE (f) == COB_TYPE_NUMERIC_DISPLAY) {
2207  return cob_display_add_int (f, n, opt);
2208  }
2209 #endif
2210 
2211  /* Not optimized */
2213 
2214  if (COB_FIELD_TYPE (f) >= COB_TYPE_NUMERIC_FLOAT
2215  && COB_FIELD_TYPE (f) <= COB_TYPE_NUMERIC_FP_BIN128) {
2216  mpz_set_si (cob_d2.value, (cob_sli_t) n);
2217  cob_d2.scale = 0;
2218  mpz_add (cob_d1.value, cob_d1.value, cob_d2.value);
2219  return cob_decimal_get_field (&cob_d1, f, opt);
2220  }
2221  else {
2222  scale = COB_FIELD_SCALE (f);
2223  val = n;
2224  if (unlikely(scale < 0)) {
2225  /* PIC 9(n)P(m) */
2226  if (-scale < 10) {
2227  while (scale++) {
2228  val /= 10;
2229  }
2230  } else {
2231  val = 0;
2232  }
2233  scale = 0;
2234  if (!val) {
2235  return 0;
2236  }
2237  }
2238  mpz_set_si (cob_d2.value, (cob_sli_t)val);
2239  cob_d2.scale = 0;
2240  if (scale > 0) {
2241  mpz_ui_pow_ui (cob_mexp, 10UL, (cob_uli_t)scale);
2242  mpz_mul (cob_d2.value, cob_d2.value, cob_mexp);
2244  }
2245  mpz_add (cob_d1.value, cob_d1.value, cob_d2.value);
2246  return cob_decimal_get_field (&cob_d1, f, opt);
2247  }
2248 }
COB_EXPIMP void cob_allocate ( unsigned char **  ,
cob_field ,
cob_field ,
cob_field  
)

References cob_field::attr, cob_alloc_base, __cob_global::cob_exception_code, cob_free(), cob_get_int(), cob_malloc(), cob_move(), cob_alloc_cache::cob_pointer, cob_set_exception(), const_alpha_attr, cob_field::data, cob_alloc_cache::next, NULL, cob_alloc_cache::size, and cob_field::size.

2750 {
2751  void *mptr;
2752  struct cob_alloc_cache *cache_ptr;
2753  int fsize;
2754  cob_field temp;
2755 
2756  /* ALLOCATE */
2758  mptr = NULL;
2759  fsize = cob_get_int (sizefld);
2760  if (fsize > 0) {
2761  cache_ptr = cob_malloc (sizeof (struct cob_alloc_cache));
2762  mptr = malloc ((size_t)fsize);
2763  if (!mptr) {
2764  cob_set_exception (COB_EC_STORAGE_NOT_AVAIL);
2765  cob_free (cache_ptr);
2766  } else {
2767  if (initialize) {
2768  temp.size = (size_t)fsize;
2769  temp.data = mptr;
2770  temp.attr = &const_alpha_attr;
2771  cob_move (initialize, &temp);
2772  } else {
2773  memset (mptr, 0, (size_t)fsize);
2774  }
2775  cache_ptr->cob_pointer = mptr;
2776  cache_ptr->size = (size_t)fsize;
2777  cache_ptr->next = cob_alloc_base;
2778  cob_alloc_base = cache_ptr;
2779  }
2780  }
2781  if (dataptr) {
2782  *dataptr = mptr;
2783  }
2784  if (retptr) {
2785  *(void **)(retptr->data) = mptr;
2786  }
2787 }
COB_EXPIMP void cob_cache_free ( void *  )

References cob_alloc_base, cob_free(), cob_alloc_cache::cob_pointer, and cob_alloc_cache::next.

1213 {
1214  struct cob_alloc_cache *cache_ptr;
1215  struct cob_alloc_cache *prev_ptr;
1216 
1217  if (!ptr) {
1218  return;
1219  }
1220  cache_ptr = cob_alloc_base;
1221  prev_ptr = cob_alloc_base;
1222  for (; cache_ptr; cache_ptr = cache_ptr->next) {
1223  if (ptr == cache_ptr->cob_pointer) {
1224  cob_free (cache_ptr->cob_pointer);
1225  if (cache_ptr == cob_alloc_base) {
1226  cob_alloc_base = cache_ptr->next;
1227  } else {
1228  prev_ptr->next = cache_ptr->next;
1229  }
1230  cob_free (cache_ptr);
1231  return;
1232  }
1233  prev_ptr = cache_ptr;
1234  }
1235 }
COB_EXPIMP void* cob_cache_malloc ( const size_t  )

References cob_alloc_base, cob_malloc(), cob_alloc_cache::cob_pointer, cob_alloc_cache::next, and cob_alloc_cache::size.

1172 {
1173  struct cob_alloc_cache *cache_ptr;
1174  void *mptr;
1175 
1176  cache_ptr = cob_malloc (sizeof (struct cob_alloc_cache));
1177  mptr = cob_malloc (size);
1178  cache_ptr->cob_pointer = mptr;
1179  cache_ptr->size = size;
1180  cache_ptr->next = cob_alloc_base;
1181  cob_alloc_base = cache_ptr;
1182  return mptr;
1183 }
COB_EXPIMP void* cob_cache_realloc ( void *  ,
const size_t   
)

References cob_alloc_base, cob_cache_malloc(), cob_free(), cob_malloc(), cob_alloc_cache::cob_pointer, cob_alloc_cache::next, and cob_alloc_cache::size.

1187 {
1188  struct cob_alloc_cache *cache_ptr;
1189  void *mptr;
1190 
1191  if (!ptr) {
1192  return cob_cache_malloc (size);
1193  }
1194  cache_ptr = cob_alloc_base;
1195  for (; cache_ptr; cache_ptr = cache_ptr->next) {
1196  if (ptr == cache_ptr->cob_pointer) {
1197  if (size <= cache_ptr->size) {
1198  return ptr;
1199  }
1200  mptr = cob_malloc (size);
1201  memcpy (mptr, cache_ptr->cob_pointer, cache_ptr->size);
1202  cob_free (cache_ptr->cob_pointer);
1203  cache_ptr->cob_pointer = mptr;
1204  cache_ptr->size = size;
1205  return mptr;
1206  }
1207  }
1208  return ptr;
1209 }
COB_EXPIMP int cob_call ( const char *  ,
const int  ,
void **   
)

References _, __cob_global::cob_call_params, cob_fatal_error(), COB_FERROR_INITIALIZED, cob_free(), cob_malloc(), COB_MAX_FIELD_PARAMS, cob_resolve_cobol(), cob_runtime_error(), cob_stop_run(), cob_call_union::funcint, cob_call_union::funcvoid, and unlikely.

1088 {
1089  void **pargv;
1090  cob_call_union unifunc;
1091  int i;
1092 
1093  if (unlikely(!cobglobptr)) {
1094  cob_fatal_error (COB_FERROR_INITIALIZED);
1095  }
1096  if (argc < 0 || argc > COB_MAX_FIELD_PARAMS) {
1097  cob_runtime_error (_("Invalid number of arguments to 'cob_call'"));
1098  cob_stop_run (1);
1099  }
1100  if (unlikely(!name)) {
1101  cob_runtime_error (_("NULL name parameter passed to 'cob_call'"));
1102  cob_stop_run (1);
1103  }
1104  unifunc.funcvoid = cob_resolve_cobol (name, 0, 1);
1105  pargv = cob_malloc (COB_MAX_FIELD_PARAMS * sizeof(void *));
1106  /* Set number of parameters */
1107  cobglobptr->cob_call_params = argc;
1108  for (i = 0; i < argc; ++i) {
1109  pargv[i] = argv[i];
1110  }
1111  i = unifunc.funcint (pargv[0], pargv[1], pargv[2], pargv[3],
1112  pargv[4], pargv[5], pargv[6], pargv[7],
1113  pargv[8], pargv[9], pargv[10], pargv[11],
1114 #if COB_MAX_FIELD_PARAMS == 16
1115  pargv[12], pargv[13], pargv[14], pargv[15]);
1116 #elif COB_MAX_FIELD_PARAMS == 36
1117  pargv[12], pargv[13], pargv[14], pargv[15],
1118  pargv[16], pargv[17], pargv[18], pargv[19],
1119  pargv[20], pargv[21], pargv[22], pargv[23],
1120  pargv[24], pargv[25], pargv[26], pargv[27],
1121  pargv[28], pargv[29], pargv[30], pargv[31],
1122  pargv[32], pargv[33], pargv[34], pargv[35]);
1123 #else
1124 #error "Invalid COB_MAX_FIELD_PARAMS value"
1125 #endif
1126  cob_free (pargv);
1127  return i;
1128 }
DECLNORET COB_EXPIMP void cob_call_error ( void  )

References cob_resolve_error(), cob_runtime_error(), and cob_stop_run().

886 {
888  cob_stop_run (1);
889 }
COB_EXPIMP void* cob_call_field ( const cob_field ,
const struct cob_call_struct ,
const unsigned  int,
const int   
)

References cob_call_error(), cob_chk_call_path(), cob_call_struct::cob_cstr_call, cob_call_struct::cob_cstr_name, cob_fatal_error(), COB_FERROR_INITIALIZED, cob_field_to_string(), cob_free(), cob_get_buff(), cob_resolve_internal(), cob_set_exception(), cob_call_union::funcvoid, NULL, p, cob_field::size, system_table::syst_call, system_table::syst_name, and unlikely.

966 {
967  void *p;
968  const struct cob_call_struct *s;
969  const struct system_table *psyst;
970  char *buff;
971  char *entry;
972  char *dirent;
973 
974  if (unlikely(!cobglobptr)) {
975  cob_fatal_error (COB_FERROR_INITIALIZED);
976  }
977 
978  buff = cob_get_buff (f->size + 1);
979  cob_field_to_string (f, buff, f->size);
980 
981  entry = cob_chk_call_path (buff, &dirent);
982 
983  /* Check if system routine */
984  for (psyst = system_tab; psyst->syst_name; ++psyst) {
985  if (!strcmp (entry, psyst->syst_name)) {
986  if (dirent) {
987  cob_free (dirent);
988  }
989  return psyst->syst_call.funcvoid;
990  }
991  }
992 
993 
994  /* Check if contained program */
995  for (s = cs; s && s->cob_cstr_name; s++) {
996  if (!strcmp (entry, s->cob_cstr_name)) {
997  if (dirent) {
998  cob_free (dirent);
999  }
1000  return s->cob_cstr_call.funcvoid;
1001  }
1002  }
1003 
1004  p = cob_resolve_internal (entry, dirent, fold_case);
1005  if (dirent) {
1006  cob_free (dirent);
1007  }
1008  if (unlikely(!p)) {
1009  if (errind) {
1010  cob_call_error ();
1011  } else {
1012  cob_set_exception (COB_EC_PROGRAM_NOT_FOUND);
1013  return NULL;
1014  }
1015  }
1016  return p;
1017 }
COB_EXPIMP void cob_cancel ( const char *  )

References _, call_table, cob_chk_dirp(), cob_fatal_error(), COB_FERROR_INITIALIZED, cob_runtime_error(), cob_stop_run(), do_cancel_module(), hash(), call_hash::name, call_hash::next, NULL, p, and unlikely.

1021 {
1022  const char *entry;
1023  struct call_hash *p;
1024  struct call_hash **q;
1025  struct call_hash *r;
1026 
1027  if (unlikely(!cobglobptr)) {
1028  cob_fatal_error (COB_FERROR_INITIALIZED);
1029  }
1030  if (unlikely(!name)) {
1031  cob_runtime_error (_("NULL parameter passed to 'cob_cancel'"));
1032  cob_stop_run (1);
1033  }
1034  entry = cob_chk_dirp (name);
1035 
1036 #ifdef COB_ALT_HASH
1037  q = &call_table;
1038  p = *q;
1039 #else
1040  q = &call_table[hash ((const unsigned char *)entry)];
1041  p = *q;
1042 #endif
1043  r = NULL;
1044  for (; p; p = p->next) {
1045  if (strcmp (entry, p->name) == 0) {
1046  do_cancel_module (p, q, r);
1047  return;
1048  }
1049  r = p;
1050  }
1051 }
COB_EXPIMP void cob_cancel_field ( const cob_field ,
const struct cob_call_struct  
)

References cob_cancel(), cob_chk_dirp(), cob_call_struct::cob_cstr_cancel, cob_call_struct::cob_cstr_name, cob_fatal_error(), COB_FERROR_INITIALIZED, cob_field_to_string(), cob_get_buff(), cob_call_union::funcint, cob_call_union::funcvoid, call_hash::name, NULL, cob_field::size, and unlikely.

1055 {
1056  char *name;
1057  const char *entry;
1058  const struct cob_call_struct *s;
1059 
1060  int (*cancel_func)(const int, void *, void *, void *, void *);
1061 
1062  if (unlikely(!cobglobptr)) {
1063  cob_fatal_error (COB_FERROR_INITIALIZED);
1064  }
1065  if (!f || f->size == 0) {
1066  return;
1067  }
1068  name = cob_get_buff (f->size + 1);
1069  cob_field_to_string (f, name, f->size);
1070  entry = cob_chk_dirp (name);
1071 
1072  /* Check if contained program */
1073  for (s = cs; s && s->cob_cstr_name; s++) {
1074  if (!strcmp (entry, s->cob_cstr_name)) {
1075  if (s->cob_cstr_cancel.funcvoid) {
1076  cancel_func = s->cob_cstr_cancel.funcint;
1077  (void)cancel_func (-1, NULL, NULL, NULL,
1078  NULL);
1079  }
1080  return;
1081  }
1082  }
1083  cob_cancel (entry);
1084 }
COB_EXPIMP void cob_chain_setup ( void *  ,
const size_t  ,
const size_t   
)

References cob_argc, cob_argv, and __cob_global::cob_call_params.

2730 {
2731  size_t len;
2732 
2733  memset (data, ' ', size);
2734  if (parm <= (size_t)cob_argc - 1) {
2735  len = strlen (cob_argv[parm]);
2736  if (len <= size) {
2737  memcpy (data, cob_argv[parm], len);
2738  } else {
2739  memcpy (data, cob_argv[parm], size);
2740  }
2741  } else {
2742  memset (data, ' ', size);
2743  }
2745 }
COB_EXPIMP void cob_check_based ( const unsigned char *  ,
const char *   
)

References _, cob_runtime_error(), and cob_stop_run().

2306 {
2307  if (!x) {
2308  cob_runtime_error (_("BASED/LINKAGE item '%s' has NULL address"), name);
2309  cob_stop_run (1);
2310  }
2311 }
COB_EXPIMP void cob_check_numeric ( const cob_field ,
const char *   
)

References _, cob_fast_malloc(), cob_free(), cob_is_numeric(), cob_runtime_error(), COB_SMALL_BUFF, cob_stop_run(), cob_field::data, p, and cob_field::size.

2315 {
2316  unsigned char *data;
2317  char *p;
2318  char *buff;
2319  size_t i;
2320 
2321  if (!cob_is_numeric (f)) {
2322  buff = cob_fast_malloc ((size_t)COB_SMALL_BUFF);
2323  p = buff;
2324  data = f->data;
2325  for (i = 0; i < f->size; ++i) {
2326  if (isprint (data[i])) {
2327  *p++ = data[i];
2328  } else {
2329  p += sprintf (p, "\\%03o", data[i]);
2330  }
2331  }
2332  *p = '\0';
2333  cob_runtime_error (_("'%s' not numeric: '%s'"), name, buff);
2334  cob_free (buff);
2335  cob_stop_run (1);
2336  }
2337 }
COB_EXPIMP void cob_check_odo ( const int  ,
const int  ,
const int  ,
const char *   
)

References _, COB_EC_BOUND_ODO, cob_runtime_error(), cob_set_exception(), and cob_stop_run().

2342 {
2343  /* Check OCCURS DEPENDING ON item */
2344  if (i < min || max < i) {
2346  cob_runtime_error (_("OCCURS DEPENDING ON '%s' out of bounds: %d"), name, i);
2347  cob_stop_run (1);
2348  }
2349 }
COB_EXPIMP void cob_check_ref_mod ( const int  ,
const int  ,
const int  ,
const char *   
)

References _, cob_runtime_error(), cob_set_exception(), and cob_stop_run().

2366 {
2367  /* Check offset */
2368  if (offset < 1 || offset > size) {
2369  cob_set_exception (COB_EC_BOUND_REF_MOD);
2370  cob_runtime_error (_("Offset of '%s' out of bounds: %d"), name, offset);
2371  cob_stop_run (1);
2372  }
2373 
2374  /* Check length */
2375  if (length < 1 || offset + length - 1 > size) {
2376  cob_set_exception (COB_EC_BOUND_REF_MOD);
2377  cob_runtime_error (_("Length of '%s' out of bounds: %d"), name, length);
2378  cob_stop_run (1);
2379  }
2380 }
COB_EXPIMP void cob_check_subscript ( const int  ,
const int  ,
const int  ,
const char *   
)

References _, cob_runtime_error(), cob_set_exception(), and cob_stop_run().

2354 {
2355  /* Check subscript */
2356  if (i < min || max < i) {
2357  cob_set_exception (COB_EC_BOUND_SUBSCRIPT);
2358  cob_runtime_error (_("Subscript of '%s' out of bounds: %d"), name, i);
2359  cob_stop_run (1);
2360  }
2361 }
COB_EXPIMP void cob_check_version ( const char *  ,
const char *  ,
const int   
)

References _, cob_runtime_error(), cob_stop_run(), PACKAGE_VERSION, and PATCH_LEVEL.

1675 {
1676  if (strcmp (packver, PACKAGE_VERSION) || patchlev != PATCH_LEVEL) {
1677  cob_runtime_error (_("Error - Version mismatch"));
1678  cob_runtime_error (_("%s has version/patch level %s/%d"), prog,
1679  packver, patchlev);
1680  cob_runtime_error (_("Library has version/patch level %s/%d"),
1682  cob_stop_run (1);
1683  }
1684 }
COB_EXPIMP void cob_close ( cob_file ,
cob_field ,
const int  ,
const int   
)

References cob_fileio_funcs::close, COB_CLOSE_LOCK, COB_FILE_SPECIAL, cob_free(), COB_LOCK_OPEN_EXCLUSIVE, COB_OPEN_CLOSED, COB_OPEN_LOCKED, COB_STATUS_00_SUCCESS, COB_STATUS_42_NOT_OPEN, cob_file::fd, file_list::file, cob_file::file, file_cache, cob_file::flag_nonexistent, cob_file::flag_operation, cob_file::flag_read_done, cob_file::lock_mode, file_list::next, NULL, cob_file::open_mode, cob_file::organization, save_status(), and unlikely.

4518 {
4519  struct file_list *l;
4520  struct file_list *m;
4521  int ret;
4522 
4523  f->flag_read_done = 0;
4524  f->flag_operation = 0;
4525 
4526  f->lock_mode &= ~COB_LOCK_OPEN_EXCLUSIVE;
4527 
4528  if (COB_FILE_SPECIAL (f)) {
4529  f->open_mode = COB_OPEN_CLOSED;
4530  f->file = NULL;
4531  f->fd = -1;
4532  save_status (f, fnstatus, COB_STATUS_00_SUCCESS);
4533  return;
4534  }
4535 
4536  if (unlikely(remfil)) {
4537  /* Remove from cache - Needed for CANCEL */
4538  /* Setting m silences false compiler warning */
4539  m = file_cache;
4540  for (l = file_cache; l; l = l->next) {
4541  if (f == l->file) {
4542  if (l == file_cache) {
4543  file_cache = l->next;
4544  } else {
4545  m->next = l->next;
4546  }
4547  cob_free (l);
4548  break;
4549  }
4550  m = l;
4551  }
4552  }
4553 
4554  if (f->open_mode == COB_OPEN_CLOSED) {
4555  save_status (f, fnstatus, COB_STATUS_42_NOT_OPEN);
4556  return;
4557  }
4558 
4559  if (f->flag_nonexistent) {
4560  ret = COB_STATUS_00_SUCCESS;
4561  } else {
4562  ret = fileio_funcs[(int)f->organization]->close (f, opt);
4563  }
4564 
4565  if (ret == COB_STATUS_00_SUCCESS) {
4566  switch (opt) {
4567  case COB_CLOSE_LOCK:
4568  f->open_mode = COB_OPEN_LOCKED;
4569  break;
4570  default:
4571  f->open_mode = COB_OPEN_CLOSED;
4572  break;
4573  }
4574  }
4575 
4576  save_status (f, fnstatus, ret);
4577 }
COB_EXPIMP int cob_cmp ( cob_field ,
cob_field  
)

References cob_field::attr, cob_cmp_all(), cob_cmp_alnum(), cob_cmp_int(), COB_FIELD_DIGITS, COB_FIELD_IS_NUMERIC, COB_FIELD_TYPE, COB_FLAG_HAVE_SIGN, cob_move(), cob_numeric_cmp(), COB_TYPE_ALPHANUMERIC_ALL, COB_TYPE_NUMERIC_DISPLAY, cob_field::data, cob_field_attr::flags, cob_field::size, and cob_field_attr::type.

2099 {
2100  cob_field temp;
2101  cob_field_attr attr;
2102  unsigned char buff[256];
2103 
2104  if (COB_FIELD_IS_NUMERIC (f1) && COB_FIELD_IS_NUMERIC (f2)) {
2105  return cob_numeric_cmp (f1, f2);
2106  }
2107  if (COB_FIELD_TYPE (f2) == COB_TYPE_ALPHANUMERIC_ALL) {
2108  if (f2->size == 1 && f2->data[0] == '0' &&
2109  COB_FIELD_IS_NUMERIC (f1)) {
2110  return cob_cmp_int (f1, 0);
2111  }
2112  return cob_cmp_all (f1, f2);
2113  }
2114  if (COB_FIELD_TYPE (f1) == COB_TYPE_ALPHANUMERIC_ALL) {
2115  if (f1->size == 1 && f1->data[0] == '0' &&
2116  COB_FIELD_IS_NUMERIC (f2)) {
2117  return -cob_cmp_int (f2, 0);
2118  }
2119  return -cob_cmp_all (f2, f1);
2120  }
2121  if (COB_FIELD_IS_NUMERIC (f1) &&
2122  COB_FIELD_TYPE (f1) != COB_TYPE_NUMERIC_DISPLAY) {
2123  temp.size = COB_FIELD_DIGITS(f1);
2124  temp.data = buff;
2125  temp.attr = &attr;
2126  attr = *f1->attr;
2128  attr.flags &= ~COB_FLAG_HAVE_SIGN;
2129  cob_move (f1, &temp);
2130  f1 = &temp;
2131  }
2132  if (COB_FIELD_IS_NUMERIC (f2) &&
2133  COB_FIELD_TYPE (f2) != COB_TYPE_NUMERIC_DISPLAY) {
2134  temp.size = COB_FIELD_DIGITS(f2);
2135  temp.data = buff;
2136  temp.attr = &attr;
2137  attr = *f2->attr;
2139  attr.flags &= ~COB_FLAG_HAVE_SIGN;
2140  cob_move (f2, &temp);
2141  f2 = &temp;
2142  }
2143  return cob_cmp_alnum (f1, f2);
2144 }
COB_EXPIMP int cob_cmp_float ( cob_field ,
cob_field  
)

References cob_decimal_get_double(), cob_decimal_set_field(), COB_FIELD_TYPE, COB_TYPE_NUMERIC_DOUBLE, COB_TYPE_NUMERIC_FLOAT, d1, d2, cob_field::data, FLOAT_EQ, and TOLERANCE.

2312 {
2313  double d1,d2;
2314  float flt;
2315  if(COB_FIELD_TYPE (f1) == COB_TYPE_NUMERIC_FLOAT) {
2316  memcpy(&flt,f1->data,sizeof(float));
2317  d1 = flt;
2318  } else if(COB_FIELD_TYPE (f1) == COB_TYPE_NUMERIC_DOUBLE) {
2319  memcpy(&d1,f1->data,sizeof(double));
2320  } else {
2323  }
2324  if(COB_FIELD_TYPE (f2) == COB_TYPE_NUMERIC_FLOAT) {
2325  memcpy(&flt,f2->data,sizeof(float));
2326  d2 = flt;
2327  } else if(COB_FIELD_TYPE (f2) == COB_TYPE_NUMERIC_DOUBLE) {
2328  memcpy(&d2,f2->data,sizeof(double));
2329  } else {
2332  }
2333  if(d1 == d2)
2334  return 0;
2335  if(d1 != 0.0
2336  && FLOAT_EQ(d1,d2,TOLERANCE))
2337  return 0;
2338  if(d1 < d2)
2339  return -1;
2340  return 1;
2341 }
COB_EXPIMP int cob_cmp_int ( cob_field ,
const int   
)

References cob_decimal_cmp(), cob_decimal_set_field(), cob_sli_t, cob_decimal::scale, and cob_decimal::value.

2258 {
2260  mpz_set_si (cob_d2.value, (cob_sli_t)n);
2261  cob_d2.scale = 0;
2262  return cob_decimal_cmp (&cob_d1, &cob_d2);
2263 }
COB_EXPIMP int cob_cmp_llint ( cob_field ,
const cob_s64_t   
)

References cob_decimal_cmp(), cob_decimal_set_field(), cob_sli_t, cob_u32_t, cob_u64_t, cob_uli_t, cob_decimal::scale, and cob_decimal::value.

2276 {
2277 #ifdef COB_LI_IS_LL
2278  mpz_set_si (cob_d2.value, (cob_sli_t)n);
2279 #else
2280  cob_u64_t uval;
2281  cob_u32_t negative;
2282 
2283  negative = 0;
2284  if (n < 0) {
2285  negative = 1;
2286  uval = (cob_u64_t)-n;
2287  } else {
2288  uval = (cob_u64_t)n;
2289  }
2290  mpz_set_ui (cob_d2.value, (cob_uli_t)(uval >> 32));
2291  mpz_mul_2exp (cob_d2.value, cob_d2.value, 32);
2292  mpz_add_ui (cob_d2.value, cob_d2.value, (cob_uli_t)(uval & 0xFFFFFFFFU));
2293  if (negative) {
2294  mpz_neg (cob_d2.value, cob_d2.value);
2295  }
2296 #endif
2297 
2298  cob_d2.scale = 0;
2300  return cob_decimal_cmp (&cob_d1, &cob_d2);
2301 }
COB_EXPIMP int cob_cmp_numdisp ( const unsigned char *  ,
const size_t  ,
const cob_s64_t  ,
const cob_u32_t   
)

References COB_D2I, cob_get_long_ebcdic_sign(), COB_MODULE_PTR, cob_s64_t, p, and unlikely.

2541 {
2542  const unsigned char *p;
2543  cob_s64_t val = 0;
2544  size_t inc;
2545 
2546  p = data;
2547  if (!has_sign) {
2548  if (unlikely(n < 0)) {
2549  return 1;
2550  }
2551  for (inc = 0; inc < size; inc++, p++) {
2552  val = (val * 10) + COB_D2I (*p);
2553  }
2554  return (val < n) ? -1 : (val > n);
2555  }
2556  for (inc = 0; inc < size - 1; inc++, p++) {
2557  val = (val * 10) + COB_D2I (*p);
2558  }
2559  val *= 10;
2560  if (*p >= (unsigned char)'0' && *p <= (unsigned char)'9') {
2561  val += COB_D2I (*p);
2562  } else {
2563  if (unlikely(COB_MODULE_PTR->ebcdic_sign)) {
2564  if (cob_get_long_ebcdic_sign (p, &val)) {
2565  val = -val;
2566  }
2567  } else {
2568 #ifdef COB_EBCDIC_MACHINE
2569  if (cob_get_long_ascii_sign (p, &val)) {
2570  val = -val;
2571  }
2572 #else
2573  if (*p >= (unsigned char)'p' && *p <= (unsigned char)'y') {
2574  val += (*p - (unsigned char)'p');
2575  val = -val;
2576  }
2577 #endif
2578  }
2579  }
2580  return (val < n) ? -1 : (val > n);
2581 }
COB_EXPIMP int cob_cmp_packed ( cob_field ,
const cob_s64_t   
)

References COB_FIELD_DIGITS, COB_FIELD_NO_SIGN_NIBBLE, cob_packed_get_sign(), cob_u64_t, cob_field::data, last_packed_val, p, packed_value, sign, and cob_field::size.

2359 {
2360  unsigned char *p;
2361  cob_u64_t n;
2362  size_t size;
2363  size_t inc;
2364  int sign;
2365  unsigned char val1[20];
2366 
2367  sign = cob_packed_get_sign (f);
2368  /* Field positive, value negative */
2369  if (sign >= 0 && val < 0) {
2370  return 1;
2371  }
2372  /* Field negative, value positive */
2373  if (sign < 0 && val >= 0) {
2374  return -1;
2375  }
2376  /* Both positive or both negative */
2377  if (val < 0) {
2378  n = (cob_u64_t)-val;
2379  } else {
2380  n = (cob_u64_t)val;
2381  }
2382  inc = 0;
2383  p = f->data;
2384  for (size = 0; size < 20; size++) {
2385  if (size < 20 - f->size) {
2386  val1[size] = 0;
2387  } else {
2388  val1[size] = p[inc++];
2389  }
2390  }
2391  if (COB_FIELD_NO_SIGN_NIBBLE (f)) {
2392  if ((COB_FIELD_DIGITS(f) % 2) == 1) {
2393  val1[20 - f->size] &= 0x0F;
2394  }
2395  } else {
2396  val1[19] &= 0xF0;
2397  if ((COB_FIELD_DIGITS(f) % 2) == 0) {
2398  val1[20 - f->size] &= 0x0F;
2399  }
2400  }
2401  if (n != last_packed_val) {
2402  last_packed_val = n;
2403  memset (packed_value, 0, sizeof(packed_value));
2404  if (n) {
2405  p = &packed_value[19];
2406  if (!COB_FIELD_NO_SIGN_NIBBLE (f)) {
2407  *p = (n % 10) << 4;
2408  p--;
2409  n /= 10;
2410  }
2411  for (; n;) {
2412  size = n % 100;
2413  *p = (unsigned char)((size % 10) | ((size / 10) << 4));
2414  n /= 100;
2415  p--;
2416  }
2417  }
2418  }
2419  for (size = 0; size < 20; size++) {
2420  if (val1[size] != packed_value[size]) {
2421  if (sign < 0) {
2422  return packed_value[size] - val1[size];
2423  } else {
2424  return val1[size] - packed_value[size];
2425  }
2426  }
2427  }
2428  return 0;
2429 }
COB_EXPIMP int cob_cmp_uint ( cob_field ,
const unsigned  int 
)

References cob_decimal_cmp(), cob_decimal_set_field(), cob_uli_t, cob_decimal::scale, and cob_decimal::value.

2267 {
2269  mpz_set_ui (cob_d2.value, (cob_uli_t)n);
2270  cob_d2.scale = 0;
2271  return cob_decimal_cmp (&cob_d1, &cob_d2);
2272 }
COB_EXPIMP void* cob_command_line ( int  ,
int *  ,
char ***  ,
char ***  ,
char **   
)

References _, cob_argc, cob_argv, cob_initialized, cob_runtime_error(), cob_stop_run(), COB_UNUSED, and NULL.

2940 {
2941 #if 0 /* RXWRXW cob_command_line */
2942  char **spenvp;
2943  char *spname;
2944 #else
2945  COB_UNUSED (penvp);
2946  COB_UNUSED (pname);
2947 #endif
2948 
2949  COB_UNUSED (flags);
2950 
2951  if (!cob_initialized) {
2952  cob_runtime_error (_("'cobcommandline' - Runtime has not been initialized"));
2953  cob_stop_run (1);
2954  }
2955  if (pargc && pargv) {
2956  cob_argc = *pargc;
2957  cob_argv = *pargv;
2958  }
2959 
2960 #if 0 /* RXWRXW cob_command_line */
2961  if (penvp) {
2962  spenvp = *penvp;
2963  }
2964  if (pname) {
2965  spname = *pname;
2966  }
2967 #endif
2968 
2969  /* What are we supposed to return here? */
2970  return NULL;
2971 }
COB_EXPIMP void cob_commit ( void  )

References cob_file_unlock(), file_list::file, and file_list::next.

4871 {
4872  struct file_list *l;
4873 
4874  for (l = file_cache; l; l = l->next) {
4875  if (l->file) {
4876  cob_file_unlock (l->file);
4877  }
4878  }
4879 }
COB_EXPIMP void cob_correct_numeric ( cob_field )

References COB_FIELD_HAVE_SIGN, COB_FIELD_IS_NUMDISP, COB_FIELD_SIGN_LEADING, COB_FIELD_SIGN_SEPARATE, COB_MODULE_PTR, cob_field::data, cob_func_loc::data, p, cob_field::size, and unlikely.

1698 {
1699  unsigned char *p;
1700  unsigned char *data;
1701  size_t size;
1702  size_t i;
1703 
1704  if (!COB_FIELD_IS_NUMDISP(f)) {
1705  return;
1706  }
1707  size = f->size;
1708  data = f->data;
1709  if (COB_FIELD_HAVE_SIGN (f)) {
1710  /* Adjust for sign byte */
1711  size--;
1712  if (unlikely(COB_FIELD_SIGN_LEADING (f))) {
1713  p = f->data;
1714  data = p + 1;
1715  } else {
1716  p = f->data + f->size - 1;
1717  }
1718  if (unlikely(COB_FIELD_SIGN_SEPARATE (f))) {
1719  if (*p != '+' && *p != '-') {
1720  *p = '+';
1721  }
1722  } else if (unlikely(COB_MODULE_PTR->ebcdic_sign)) {
1723  switch (*p) {
1724  case '{':
1725  case 'A':
1726  case 'B':
1727  case 'C':
1728  case 'D':
1729  case 'E':
1730  case 'F':
1731  case 'G':
1732  case 'H':
1733  case 'I':
1734  case '}':
1735  case 'J':
1736  case 'K':
1737  case 'L':
1738  case 'M':
1739  case 'N':
1740  case 'O':
1741  case 'P':
1742  case 'Q':
1743  case 'R':
1744  break;
1745  case '0':
1746  *p = '{';
1747  break;
1748  case '1':
1749  *p = 'A';
1750  break;
1751  case '2':
1752  *p = 'B';
1753  break;
1754  case '3':
1755  *p = 'C';
1756  break;
1757  case '4':
1758  *p = 'D';
1759  break;
1760  case '5':
1761  *p = 'E';
1762  break;
1763  case '6':
1764  *p = 'F';
1765  break;
1766  case '7':
1767  *p = 'G';
1768  break;
1769  case '8':
1770  *p = 'H';
1771  break;
1772  case '9':
1773  *p = 'I';
1774  break;
1775  case 0:
1776  case ' ':
1777  *p = '{';
1778  break;
1779  default:
1780  break;
1781  }
1782  } else {
1783  if(!*p || *p == ' ') {
1784  *p = '0';
1785  }
1786  }
1787  } else {
1788  p = f->data + f->size - 1;
1789  if (unlikely(COB_MODULE_PTR->ebcdic_sign)) {
1790  switch (*p) {
1791  case 0:
1792  case ' ':
1793  case '{':
1794  case '}':
1795  *p = '0';
1796  break;
1797  case 'A':
1798  case 'B':
1799  case 'C':
1800  case 'D':
1801  case 'E':
1802  case 'F':
1803  case 'G':
1804  case 'H':
1805  case 'I':
1806  *p = '1' + (*p - 'A');
1807  break;
1808  case 'J':
1809  case 'K':
1810  case 'L':
1811  case 'M':
1812  case 'N':
1813  case 'O':
1814  case 'P':
1815  case 'Q':
1816  case 'R':
1817  *p = '1' + (*p - 'J');
1818  break;
1819  default:
1820  break;
1821  }
1822  } else {
1823  switch (*p) {
1824  case 0:
1825  case ' ':
1826  case 'p':
1827  *p = '0';
1828  break;
1829  case 'q':
1830  *p = '1';
1831  break;
1832  case 'r':
1833  *p = '2';
1834  break;
1835  case 's':
1836  *p = '3';
1837  break;
1838  case 't':
1839  *p = '4';
1840  break;
1841  case 'u':
1842  *p = '5';
1843  break;
1844  case 'v':
1845  *p = '6';
1846  break;
1847  case 'w':
1848  *p = '7';
1849  break;
1850  case 'x':
1851  *p = '8';
1852  break;
1853  case 'y':
1854  *p = '9';
1855  break;
1856  default:
1857  break;
1858  }
1859  }
1860  }
1861  for (i = 0, p = data; i < size; ++i, ++p) {
1862  switch (*p) {
1863  case '0':
1864  case '1':
1865  case '2':
1866  case '3':
1867  case '4':
1868  case '5':
1869  case '6':
1870  case '7':
1871  case '8':
1872  case '9':
1873  break;
1874  case 0:
1875  case ' ':
1876  *p = '0';
1877  break;
1878  default:
1879  if ((*p & 0x0F) <= 9) {
1880  *p = (*p & 0x0F) + '0';
1881  }
1882  break;
1883  }
1884  }
1885 }
COB_EXPIMP void cob_decimal_add ( cob_decimal ,
cob_decimal  
)

References align_decimal(), DECIMAL_CHECK, and cob_decimal::value.

1876 {
1877  DECIMAL_CHECK (d1, d2);
1878  align_decimal (d1, d2);
1879  mpz_add (d1->value, d1->value, d2->value);
1880 }
COB_EXPIMP void cob_decimal_alloc ( const cob_u32_t  ,
  ... 
)

References cob_u32_t, and params.

2585 {
2586  cob_decimal **dec;
2587  cob_u32_t i;
2588  va_list args;
2589 
2590  va_start (args, params);
2591  for (i = 0; i < params; ++i) {
2592  dec = va_arg (args, cob_decimal **);
2593  *dec = cob_decimal_base + i;
2594  }
2595  va_end (args);
2596 }
COB_EXPIMP int cob_decimal_cmp ( cob_decimal ,
cob_decimal  
)

References align_decimal(), and cob_decimal::value.

1923 {
1924  align_decimal (d1, d2);
1925  return mpz_cmp (d1->value, d2->value);
1926 }
COB_EXPIMP void cob_decimal_div ( cob_decimal ,
cob_decimal  
)

References COB_DECIMAL_NAN, COB_EC_SIZE_ZERO_DIVIDE, COB_MAX_DIGITS, cob_set_exception(), DECIMAL_CHECK, cob_decimal::scale, shift_decimal(), unlikely, and cob_decimal::value.

1900 {
1901  DECIMAL_CHECK (d1, d2);
1902 
1903  /* Check for division by zero */
1904  if (unlikely(mpz_sgn (d2->value) == 0)) {
1907  return;
1908  }
1909  if (unlikely(mpz_sgn (d1->value) == 0)) {
1910  d1->scale = 0;
1911  return;
1912  }
1913  d1->scale -= d2->scale;
1914  shift_decimal (d1, COB_MAX_DIGITS + ((d1->scale < 0) ? -d1->scale : 0));
1915 #if 0 /* RXWRXW - cdiv */
1916  mpz_cdiv_q (d1->value, d1->value, d2->value);
1917 #endif
1918  mpz_tdiv_q (d1->value, d1->value, d2->value);
1919 }
COB_EXPIMP int cob_decimal_get_field ( cob_decimal ,
cob_field ,
const int   
)

References cob_field::attr, COB_ATTR_INIT, cob_d1, cob_decimal_do_round(), cob_decimal_get_binary(), cob_decimal_get_display(), cob_decimal_get_double(), cob_decimal_get_ieee128dec(), cob_decimal_get_ieee64dec(), cob_decimal_get_packed(), COB_DECIMAL_NAN, __cob_global::cob_exception_code, COB_FIELD_DIGITS, COB_FIELD_IS_FP, COB_FIELD_SCALE, COB_FIELD_TYPE, COB_FLAG_HAVE_SIGN, cob_free(), cob_malloc(), cob_move(), cob_set_exception(), COB_STORE_ROUND, COB_TYPE_NUMERIC_BINARY, COB_TYPE_NUMERIC_DISPLAY, COB_TYPE_NUMERIC_DOUBLE, COB_TYPE_NUMERIC_FLOAT, COB_TYPE_NUMERIC_FP_DEC128, COB_TYPE_NUMERIC_FP_DEC64, COB_TYPE_NUMERIC_PACKED, cob_field::data, NULL, cob_decimal::scale, shift_decimal(), cob_field::size, unlikely, and cob_decimal::value.

1802 {
1803  cob_field temp;
1804  cob_field_attr attr;
1805  union {
1806  double val;
1807  float fval;
1808  } uval;
1809 
1810  if (unlikely(d->scale == COB_DECIMAL_NAN)) {
1811  cob_set_exception (COB_EC_SIZE_OVERFLOW);
1813  }
1814 
1815  /* work copy */
1816  if (d != &cob_d1) {
1817  mpz_set (cob_d1.value, d->value);
1818  cob_d1.scale = d->scale;
1819  d = &cob_d1;
1820  }
1821 
1822 #if 0 /* RXWRXW - Round FP */
1823  if (!COB_FIELD_IS_FP(f)) {
1824 #endif
1825  /* Rounding */
1826  if ((opt & COB_STORE_ROUND)) {
1827  cob_decimal_do_round (d, f, opt);
1828  }
1829  /* Append or truncate decimal digits */
1830  shift_decimal (d, COB_FIELD_SCALE(f) - d->scale);
1831 #if 0 /* RXWRXW - Round FP */
1832  }
1833 #endif
1834 
1835  /* Store number */
1836  switch (COB_FIELD_TYPE (f)) {
1838  return cob_decimal_get_binary (d, f, opt);
1840  return cob_decimal_get_display (d, f, opt);
1842  return cob_decimal_get_packed (d, f, opt);
1844  uval.fval = (float) cob_decimal_get_double (d);
1845  memcpy (f->data, &uval.fval, sizeof (float));
1846  return 0;
1848  uval.val = cob_decimal_get_double (d);
1849  memcpy (f->data, &uval.val, sizeof (double));
1850  return 0;
1852  return cob_decimal_get_ieee64dec (d, f, opt);
1854  return cob_decimal_get_ieee128dec (d, f, opt);
1855  default:
1856  break;
1857  }
1858  COB_ATTR_INIT (COB_TYPE_NUMERIC_DISPLAY, COB_FIELD_DIGITS(f),
1859  COB_FIELD_SCALE(f), COB_FLAG_HAVE_SIGN, NULL);
1860  temp.size = COB_FIELD_DIGITS(f);
1861  temp.data = cob_malloc (COB_FIELD_DIGITS(f));
1862  temp.attr = &attr;
1863  if (cob_decimal_get_display (d, &temp, opt) == 0) {
1864  cob_move (&temp, f);
1865  cob_free (temp.data);
1866  return 0;
1867  }
1868  cob_free (temp.data);
1870 }
COB_EXPIMP void cob_decimal_init ( cob_decimal )

References COB_MPZ_DEF, cob_decimal::scale, and cob_decimal::value.

322 {
323  mpz_init2 (d->value, COB_MPZ_DEF);
324  d->scale = 0;
325 }
COB_EXPIMP void cob_decimal_mul ( cob_decimal ,
cob_decimal  
)

References DECIMAL_CHECK, cob_decimal::scale, and cob_decimal::value.

1892 {
1893  DECIMAL_CHECK (d1, d2);
1894  d1->scale += d2->scale;
1895  mpz_mul (d1->value, d1->value, d2->value);
1896 }
COB_EXPIMP void cob_decimal_pop ( const cob_u32_t  ,
  ... 
)

References cob_free(), cob_u32_t, params, and cob_decimal::value.

2616 {
2617  cob_decimal *dec;
2618  cob_u32_t i;
2619  va_list args;
2620 
2621  va_start (args, params);
2622  for (i = 0; i < params; ++i) {
2623  dec = va_arg (args, cob_decimal *);
2624  mpz_clear (dec->value);
2625  cob_free (dec);
2626  }
2627  va_end (args);
2628 }
COB_EXPIMP void cob_decimal_pow ( cob_decimal ,
cob_decimal  
)

References cob_decimal_div(), cob_decimal_get_mpf(), COB_DECIMAL_NAN, cob_decimal_set(), cob_decimal_set_mpf(), cob_mpf_exp(), cob_mpf_log(), cob_mpft, cob_mpft2, cob_set_exception(), cob_trim_decimal(), cob_uli_t, cob_decimal::scale, sign, unlikely, and cob_decimal::value.

1962 {
1963  cob_uli_t n;
1964  int sign;
1965 
1966  if (unlikely(pd1->scale == COB_DECIMAL_NAN)) {
1967  return;
1968  }
1969  if (unlikely(pd2->scale == COB_DECIMAL_NAN)) {
1970  pd1->scale = COB_DECIMAL_NAN;
1971  return;
1972  }
1973 
1974  sign = mpz_sgn (pd1->value);
1975 
1976  if (!mpz_sgn (pd2->value)) {
1977  /* Exponent is zero */
1978  if (!sign) {
1979  /* 0 ^ 0 */
1980  cob_set_exception (COB_EC_SIZE_EXPONENTIATION);
1981  }
1982  mpz_set_ui (pd1->value, 1UL);
1983  pd1->scale = 0;
1984  return;
1985  }
1986  if (!sign) {
1987  /* Value is zero */
1988  pd1->scale = 0;
1989  return;
1990  }
1991 
1992  cob_trim_decimal (pd2);
1993 
1994  if (sign < 0 && pd2->scale) {
1995  /* Negative exponent and non-integer power */
1996  pd1->scale = COB_DECIMAL_NAN;
1997  cob_set_exception (COB_EC_SIZE_EXPONENTIATION);
1998  return;
1999  }
2000 
2001  cob_trim_decimal (pd1);
2002 
2003  if (!pd2->scale) {
2004  /* Integer power */
2005  if (!mpz_cmp_ui (pd2->value, 1UL)) {
2006  /* Power is 1 */
2007  return;
2008  }
2009  if (mpz_sgn (pd2->value) < 0 && mpz_fits_slong_p (pd2->value)) {
2010  /* Negative power */
2011  mpz_abs (pd2->value, pd2->value);
2012  n = mpz_get_ui (pd2->value);
2013  mpz_pow_ui (pd1->value, pd1->value, n);
2014  if (pd1->scale) {
2015  pd1->scale *= n;
2016  cob_trim_decimal (pd1);
2017  }
2018  cob_decimal_set (pd2, pd1);
2019  mpz_set_ui (pd1->value, 1UL),
2020  pd1->scale = 0;
2021  cob_decimal_div (pd1, pd2);
2022  cob_trim_decimal (pd1);
2023  return;
2024  }
2025  if (mpz_fits_ulong_p (pd2->value)) {
2026  /* Positive power */
2027  n = mpz_get_ui (pd2->value);
2028  mpz_pow_ui (pd1->value, pd1->value, n);
2029  if (pd1->scale) {
2030  pd1->scale *= n;
2031  cob_trim_decimal (pd1);
2032  }
2033  return;
2034  }
2035  }
2036 
2037  if (sign < 0) {
2038  mpz_abs (pd1->value, pd1->value);
2039  }
2041  if (pd2->scale == 1 && !mpz_cmp_ui (pd2->value, 5UL)) {
2042  /* Square root short cut */
2043  mpf_sqrt (cob_mpft2, cob_mpft);
2044  } else {
2047  mpf_mul (cob_mpft, cob_mpft, cob_mpft2);
2049  }
2051  if (sign < 0) {
2052  mpz_neg (pd1->value, pd1->value);
2053  }
2054 }
COB_EXPIMP void cob_decimal_push ( const cob_u32_t  ,
  ... 
)

References cob_decimal_init(), cob_malloc(), cob_u32_t, and params.

2600 {
2601  cob_decimal **dec;
2602  cob_u32_t i;
2603  va_list args;
2604 
2605  va_start (args, params);
2606  for (i = 0; i < params; ++i) {
2607  dec = va_arg (args, cob_decimal **);
2608  *dec = cob_malloc (sizeof(cob_decimal));
2609  cob_decimal_init (*dec);
2610  }
2611  va_end (args);
2612 }
COB_EXPIMP void cob_decimal_set_field ( cob_decimal ,
cob_field  
)

References cob_decimal_set_binary(), cob_decimal_set_display(), cob_decimal_set_double(), cob_decimal_set_ieee128dec(), cob_decimal_set_ieee64dec(), cob_decimal_set_packed(), COB_FIELD_TYPE, COB_TYPE_NUMERIC_BINARY, COB_TYPE_NUMERIC_DOUBLE, COB_TYPE_NUMERIC_FLOAT, COB_TYPE_NUMERIC_FP_DEC128, COB_TYPE_NUMERIC_FP_DEC64, COB_TYPE_NUMERIC_PACKED, and cob_field::data.

1613 {
1614  union {
1615  double dval;
1616  float fval;
1617  } uval;
1618 
1619  switch (COB_FIELD_TYPE (f)) {
1621  cob_decimal_set_binary (d, f);
1622  break;
1624  cob_decimal_set_packed (d, f);
1625  break;
1627  memcpy ((void *)&uval.fval, f->data, sizeof(float));
1628  cob_decimal_set_double (d, (double)uval.fval);
1629  break;
1631  memcpy ((void *)&uval.dval, f->data, sizeof(double));
1632  cob_decimal_set_double (d, uval.dval);
1633  break;
1636  break;
1639  break;
1640  default:
1641  cob_decimal_set_display (d, f);
1642  break;
1643  }
1644 }
COB_EXPIMP void cob_decimal_set_llint ( cob_decimal ,
const cob_s64_t   
)

References cob_sli_t, cob_u32_t, cob_u64_t, cob_uli_t, cob_decimal::scale, and cob_decimal::value.

329 {
330 #ifdef COB_LI_IS_LL
331  mpz_set_si (d->value, (cob_sli_t)n);
332 #else
333  cob_u64_t uval;
334  cob_u32_t negative;
335 
336  negative = 0;
337  if (n < 0) {
338  negative = 1;
339  uval = (cob_u64_t)-n;
340  } else {
341  uval = (cob_u64_t)n;
342  }
343  mpz_set_ui (d->value, (cob_uli_t)(uval >> 32));
344  mpz_mul_2exp (d->value, d->value, 32);
345  mpz_add_ui (d->value, d->value, (cob_uli_t)(uval & 0xFFFFFFFFU));
346  if (negative) {
347  mpz_neg (d->value, d->value);
348  }
349 #endif
350  d->scale = 0;
351 }
COB_EXPIMP void cob_decimal_sub ( cob_decimal ,
cob_decimal  
)

References align_decimal(), DECIMAL_CHECK, and cob_decimal::value.

1884 {
1885  DECIMAL_CHECK (d1, d2);
1886  align_decimal (d1, d2);
1887  mpz_sub (d1->value, d1->value, d2->value);
1888 }
COB_EXPIMP void cob_delete ( cob_file ,
cob_field  
)

References cob_file::access_mode, COB_ACCESS_SEQUENTIAL, COB_OPEN_I_O, COB_STATUS_43_READ_NOT_DONE, COB_STATUS_49_I_O_DENIED, cob_fileio_funcs::fdelete, cob_file::flag_read_done, cob_file::open_mode, cob_file::organization, save_status(), and unlikely.

4849 {
4850  int read_done;
4851 
4852  read_done = f->flag_read_done;
4853  f->flag_read_done = 0;
4854 
4855  if (unlikely(f->open_mode != COB_OPEN_I_O)) {
4856  save_status (f, fnstatus, COB_STATUS_49_I_O_DENIED);
4857  return;
4858  }
4859 
4860  if (f->access_mode == COB_ACCESS_SEQUENTIAL && !read_done) {
4862  return;
4863  }
4864 
4865  save_status (f, fnstatus,
4866  fileio_funcs[(int)f->organization]->fdelete (f));
4867 }
COB_EXPIMP void cob_delete_file ( cob_file ,
cob_field  
)

References cob_file::assign, cob_chk_file_mapping(), cob_field_to_string(), COB_FILE_MAX, COB_FILE_STDIN, COB_FILE_STDOUT, COB_OPEN_CLOSED, COB_OPEN_LOCKED, COB_ORG_INDEXED, COB_ORG_SORT, COB_STATUS_00_SUCCESS, COB_STATUS_30_PERMANENT_ERROR, COB_STATUS_38_CLOSED_WITH_LOCK, COB_STATUS_41_ALREADY_OPEN, COB_STATUS_91_NOT_AVAILABLE, file_open_name, indexed_file_delete(), cob_file::open_mode, cob_file::organization, save_status(), and unlikely.

4895 {
4896  if (f->organization == COB_ORG_SORT) {
4898  return;
4899  }
4900 
4901  /* File was previously closed with lock */
4902  if (f->open_mode == COB_OPEN_LOCKED) {
4904  return;
4905  }
4906 
4907  /* File is open */
4908  if (f->open_mode != COB_OPEN_CLOSED) {
4909  save_status (f, fnstatus, COB_STATUS_41_ALREADY_OPEN);
4910  return;
4911  }
4912 
4913  if (unlikely(COB_FILE_STDIN (f))) {
4915  return;
4916  }
4917  if (unlikely(COB_FILE_STDOUT (f))) {
4919  return;
4920  }
4921 
4922  /* Obtain the file name */
4923  cob_field_to_string (f->assign, file_open_name, (size_t)COB_FILE_MAX);
4925 
4926  if (f->organization != COB_ORG_INDEXED) {
4927 #ifdef WITH_SEQRA_EXTFH
4929  return;
4930 #else
4931  unlink (file_open_name);
4932 #endif
4933  } else {
4934 #ifdef WITH_INDEX_EXTFH
4936  return;
4937 #else
4939 #endif
4940  }
4941  save_status (f, fnstatus, COB_STATUS_00_SUCCESS);
4942 }
COB_EXPIMP void cob_display ( const int  ,
const int  ,
const int  ,
  ... 
)

References COB_DISP_TO_STDERR, cob_field_display(), COB_SCREEN_EMULATE_NL, __cob_global::cob_screen_initialized, cob_u32_t, display_common(), NULL, and unlikely.

238 {
239  FILE *fp;
240  cob_field *f;
241  int i;
242  int nlattr;
243  cob_u32_t disp_redirect;
244  va_list args;
245 
246  disp_redirect = 0;
247  if (to_stderr) {
248  fp = stderr;
249  } else {
250  fp = stdout;
252  if (!COB_DISP_TO_STDERR) {
253  disp_redirect = 1;
254  } else {
255  fp = stderr;
256  }
257  }
258  }
259 
260  nlattr = newline ? COB_SCREEN_EMULATE_NL : 0;
261  va_start (args, varcnt);
262  for (i = 0; i < varcnt; ++i) {
263  f = va_arg (args, cob_field *);
264  if (unlikely(disp_redirect)) {
266  NULL, nlattr);
267  } else {
268  display_common (f, fp);
269  }
270  }
271  va_end (args);
272 
273  if (newline && !disp_redirect) {
274  putc ('\n', fp);
275  fflush (fp);
276  }
277 }
COB_EXPIMP void cob_display_arg_number ( cob_field )

References cob_field::attr, cob_argc, COB_ATTR_INIT, cob_move(), cob_set_exception(), COB_TYPE_NUMERIC_BINARY, current_arg, cob_field::data, NULL, and cob_field::size.

2571 {
2572  int n;
2573  cob_field_attr attr;
2574  cob_field temp;
2575 
2576  temp.size = 4;
2577  temp.data = (unsigned char *)&n;
2578  temp.attr = &attr;
2579  COB_ATTR_INIT (COB_TYPE_NUMERIC_BINARY, 9, 0, 0, NULL);
2580  cob_move (f, &temp);
2581  if (n < 0 || n >= cob_argc) {
2582  cob_set_exception (COB_EC_IMP_DISPLAY);
2583  return;
2584  }
2585  current_arg = n;
2586 }
COB_EXPIMP void cob_display_command_line ( cob_field )

References cob_free(), cob_malloc(), commlncnt, commlnptr, cob_field::data, and cob_field::size.

2515 {
2516  if (commlnptr) {
2517  cob_free (commlnptr);
2518  }
2519  commlnptr = cob_malloc (f->size + 1U);
2520  commlncnt = f->size;
2521  memcpy (commlnptr, f->data, commlncnt);
2522 }
COB_EXPIMP void cob_display_env_value ( const cob_field )

References cob_fast_malloc(), cob_field_to_string(), cob_free(), cob_local_env, cob_malloc(), cob_rescan_env_vals(), cob_set_exception(), p, and cob_field::size.

2641 {
2642  char *env2;
2643 #if !HAVE_SETENV
2644  char *p;
2645  size_t len;
2646 #endif
2647  int ret;
2648 
2649  if (!cob_local_env) {
2650  cob_set_exception (COB_EC_IMP_DISPLAY);
2651  return;
2652  }
2653  if (!*cob_local_env) {
2654  cob_set_exception (COB_EC_IMP_DISPLAY);
2655  return;
2656  }
2657  env2 = cob_malloc (f->size + 1U);
2658  cob_field_to_string (f, env2, f->size);
2659 #if HAVE_SETENV
2660  ret = setenv(cob_local_env, env2, 1);
2661 #else
2662  len = strlen (cob_local_env) + strlen (env2) + 3U;
2663  p = cob_fast_malloc (len);
2664  sprintf (p, "%s=%s", cob_local_env, env2);
2665  ret = putenv (p);
2666 #endif
2667  cob_free (env2);
2668  if (ret != 0) {
2669  cob_set_exception (COB_EC_IMP_DISPLAY);
2670  return;
2671  }
2672  /* Rescan term/screen variables */
2674 }
COB_EXPIMP void cob_display_environment ( const cob_field )

References __cob_global::cob_env_mangle, cob_field_to_string(), cob_free(), cob_local_env, cob_local_env_size, cob_malloc(), cob_field::size, and unlikely.

2619 {
2620  size_t i;
2621 
2622  if (cob_local_env_size < f->size) {
2623  cob_local_env_size = f->size;
2624  if (cob_local_env) {
2626  }
2628  }
2631  for (i = 0; i < strlen (cob_local_env); ++i) {
2632  if (!isalnum ((int)cob_local_env[i])) {
2633  cob_local_env[i] = '_';
2634  }
2635  }
2636  }
2637 }
COB_EXPIMP void cob_div ( cob_field ,
cob_field ,
const int   
)

References cob_decimal_div(), cob_decimal_get_field(), and cob_decimal_set_field().

1959 {
1963  (void)cob_decimal_get_field (&cob_d1, f1, opt);
1964 }
COB_EXPIMP void cob_div_quotient ( cob_field ,
cob_field ,
cob_field ,
const int   
)

References cob_decimal_div(), cob_decimal_get_field(), cob_decimal_mul(), COB_DECIMAL_NAN, cob_decimal_set(), cob_decimal_set_field(), cob_decimal_sub(), COB_FIELD_SCALE, cob_decimal::scale, and shift_decimal().

1969 {
1970  /* Note that cob_div_quotient and cob_div_remainder must remain */
1971  /* separate because of COBOL rules. The quotient must be fully */
1972  /* evaluated before the remainder item is evaluated */
1973  /* eg. DIVIDE A BY B GIVING Z REMAINDER FLD (Z). */
1974 
1975  cob_decimal_set_field (&cob_d1, dividend);
1976  cob_decimal_set_field (&cob_d2, divisor);
1978 
1979  /* Compute quotient */
1981  /* Check divide by zero - Exception is set in cob_decimal_div */
1982  if (cob_d1.scale == COB_DECIMAL_NAN) {
1983  /* Forces an early return from cob_div_remainder */
1985  return;
1986  }
1987 
1988  /* Set quotient */
1990  (void)cob_decimal_get_field (&cob_d1, quotient, opt);
1991 
1992  /* Truncate digits from the quotient */
1994 
1995  /* Compute remainder */
1998 }
COB_EXPIMP void cob_div_remainder ( cob_field ,
const int   
)

References cob_decimal_get_field().

2002 {
2003  (void)cob_decimal_get_field (&cob_d_remainder, fld_remainder, opt);
2004 }
COB_EXPIMP int cob_extern_init ( void  )

References cob_init(), and NULL.

2932 {
2933  cob_init (0, NULL);
2934  return 0;
2935 }
COB_EXPIMP void* cob_external_addr ( const char *  ,
const int   
)

References _, basext, __cob_global::cob_initial_external, cob_malloc(), cob_runtime_error(), cob_stop_run(), cob_external::ename, cob_external::esize, cob_external::ext_alloc, and cob_external::next.

2384 {
2385  struct cob_external *eptr;
2386 
2387  /* Locate or allocate EXTERNAL item */
2388  for (eptr = basext; eptr; eptr = eptr->next) {
2389  if (!strcmp (exname, eptr->ename)) {
2390  if (exlength > eptr->esize) {
2391  cob_runtime_error (_("EXTERNAL item '%s' previously allocated with size %d, requested size is %d"),
2392  exname, eptr->esize, exlength);
2393  cob_stop_run (1);
2394  }
2396  return eptr->ext_alloc;
2397  }
2398  }
2399  eptr = cob_malloc (sizeof (struct cob_external));
2400  eptr->next = basext;
2401  eptr->esize = exlength;
2402  eptr->ename = cob_malloc (strlen (exname) + 1U);
2403  strcpy (eptr->ename, exname);
2404  eptr->ext_alloc = cob_malloc ((size_t)exlength);
2405  basext = eptr;
2407  return eptr->ext_alloc;
2408 }
COB_EXPIMP void* cob_fast_malloc ( const size_t  )

References cob_fatal_error(), COB_FERROR_MEMORY, and unlikely.

1147 {
1148  void *mptr;
1149 
1150  mptr = malloc (size);
1151  if (unlikely(!mptr)) {
1152  cob_fatal_error (COB_FERROR_MEMORY);
1153  }
1154  return mptr;
1155 }
DECLNORET COB_EXPIMP void cob_fatal_error ( const int  )

References _, cob_file::assign, COB_D2I, __cob_global::cob_error_file, COB_FERROR_CANCEL, COB_FERROR_CHAINING, COB_FERROR_CODEGEN, COB_FERROR_FILE, COB_FERROR_FREE, COB_FERROR_FUNCTION, COB_FERROR_GLOBAL, COB_FERROR_INITIALIZED, COB_FERROR_MEMORY, COB_FERROR_MODULE, COB_FERROR_NONE, COB_FERROR_RECURSIVE, COB_FERROR_STACK, cob_field_to_string(), COB_FILE_BUFF, COB_FILE_MAX, cob_free(), cob_malloc(), cob_runtime_error(), COB_STATUS_10_END_OF_FILE, COB_STATUS_14_OUT_OF_KEY_RANGE, COB_STATUS_21_KEY_INVALID, COB_STATUS_22_KEY_EXISTS, COB_STATUS_23_KEY_NOT_EXISTS, COB_STATUS_30_PERMANENT_ERROR, COB_STATUS_35_NOT_EXISTS, COB_STATUS_37_PERMISSION_DENIED, COB_STATUS_41_ALREADY_OPEN, COB_STATUS_42_NOT_OPEN, COB_STATUS_43_READ_NOT_DONE, COB_STATUS_44_RECORD_OVERFLOW, COB_STATUS_46_READ_ERROR, COB_STATUS_47_INPUT_DENIED, COB_STATUS_48_OUTPUT_DENIED, COB_STATUS_49_I_O_DENIED, COB_STATUS_51_RECORD_LOCKED, COB_STATUS_57_I_O_LINAGE, COB_STATUS_61_FILE_SHARING, COB_STATUS_91_NOT_AVAILABLE, cob_stop_run(), and cob_file::file_status.

1441 {
1442  const char *msg;
1443  unsigned char *file_status;
1444  char *filename;
1445  int status;
1446 
1447  switch (fatal_error) {
1448  case COB_FERROR_NONE:
1449  cob_runtime_error (_("cob_init() has not been called"));
1450  break;
1451  case COB_FERROR_CANCEL:
1452  cob_runtime_error (_("Attempt to CANCEL active program"));
1453  break;
1455  cob_runtime_error (_("cob_init() has not been called"));
1456  break;
1457  case COB_FERROR_CODEGEN:
1458  cob_runtime_error (_("Codegen error - Please report this"));
1459  break;
1460  case COB_FERROR_CHAINING:
1461  cob_runtime_error (_("Recursive call of chained program"));
1462  break;
1463  case COB_FERROR_STACK:
1464  cob_runtime_error (_("Stack overflow, possible PERFORM depth exceeded"));
1465  break;
1466  case COB_FERROR_GLOBAL:
1467  cob_runtime_error (_("Invalid entry/exit in GLOBAL USE procedure"));
1468  break;
1469  case COB_FERROR_MEMORY:
1470  cob_runtime_error (_("Unable to allocate memory"));
1471  break;
1472  case COB_FERROR_MODULE:
1473  cob_runtime_error (_("Invalid entry into module"));
1474  break;
1475  case COB_FERROR_RECURSIVE:
1476  cob_runtime_error (_("Invalid recursive COBOL CALL"));
1477  break;
1478  case COB_FERROR_FREE:
1479  cob_runtime_error (_("Call to cob_free with NULL pointer"));
1480  break;
1481  case COB_FERROR_FILE:
1482  file_status = cobglobptr->cob_error_file->file_status;
1483  status = COB_D2I(file_status[0]) * 10 + COB_D2I(file_status[1]);
1484  switch (status) {
1486  msg = _("End of file");
1487  break;
1489  msg = _("Key out of range");
1490  break;
1492  msg = _("Key order not ascending");
1493  break;
1495  msg = _("Record key already exists");
1496  break;
1498  msg = _("Record key does not exist");
1499  break;
1501  msg = _("Permanent file error");
1502  break;
1504  msg = _("File does not exist");
1505  break;
1507  msg = _("Permission denied");
1508  break;
1510  msg = _("File already open");
1511  break;
1513  msg = _("File not open");
1514  break;
1516  msg = _("READ must be executed first");
1517  break;
1519  msg = _("Record overflow");
1520  break;
1522  msg = _("Failed to read");
1523  break;
1525  msg = _("READ/START not allowed");
1526  break;
1528  msg = _("WRITE not allowed");
1529  break;
1531  msg = _("DELETE/REWRITE not allowed");
1532  break;
1534  msg = _("Record locked by another file connector");
1535  break;
1537  msg = _("LINAGE values invalid");
1538  break;
1540  msg = _("File sharing conflict");
1541  break;
1543  msg = _("Runtime library is not configured for this operation");
1544  break;
1545  default:
1546  msg = _("Unknown file error");
1547  break;
1548  }
1549  filename = cob_malloc ((size_t)COB_FILE_BUFF);
1551  filename, (size_t)COB_FILE_MAX);
1552  cob_runtime_error (_("%s (Status = %02d) File : '%s'"),
1553  msg, status, filename);
1554  cob_free (filename);
1555  break;
1556  case COB_FERROR_FUNCTION:
1557  cob_runtime_error (_("Attempt to use non-implemented function"));
1558  break;
1559  default:
1560  cob_runtime_error (_("Unknown failure : %d"), fatal_error);
1561  break;
1562  }
1563  cob_stop_run (1);
1564 }
COB_EXPIMP void cob_field_accept ( cob_field ,
cob_field ,
cob_field ,
cob_field ,
cob_field ,
cob_field ,
cob_field ,
cob_field ,
const int   
)

References COB_UNUSED.

1703 {
1704  COB_UNUSED (f);
1705  COB_UNUSED (line);
1706  COB_UNUSED (column);
1707  COB_UNUSED (fgc);
1708  COB_UNUSED (bgc);
1709  COB_UNUSED (fscroll);
1710  COB_UNUSED (ftimeout);
1711  COB_UNUSED (prompt);
1712  COB_UNUSED (attr);
1713 }
COB_EXPIMP void cob_field_display ( cob_field ,
cob_field ,
cob_field ,
cob_field ,
cob_field ,
cob_field ,
const int   
)

References COB_UNUSED.

1689 {
1690  COB_UNUSED (f);
1691  COB_UNUSED (line);
1692  COB_UNUSED (column);
1693  COB_UNUSED (fgc);
1694  COB_UNUSED (bgc);
1695  COB_UNUSED (fscroll);
1696  COB_UNUSED (attr);
1697 }
COB_EXPIMP void cob_file_release ( cob_file )

References cob_file_sort_submit(), COB_STATUS_00_SUCCESS, COB_STATUS_30_PERMANENT_ERROR, cob_field::data, cob_file::file, cobsort::fnstatus, likely, NULL, cob_file::record, save_status(), and cobsort::sort_return.

6247 {
6248  struct cobsort *hp;
6250  int ret;
6251 
6252  fnstatus = NULL;
6253  hp = f->file;
6254  if (likely(hp)) {
6255  fnstatus = hp->fnstatus;
6256  }
6257  ret = cob_file_sort_submit (f, f->record->data);
6258  if (!ret) {
6259  save_status (f, fnstatus, COB_STATUS_00_SUCCESS);
6260  return;
6261  }
6262  if (likely(hp)) {
6263  *(int *)(hp->sort_return) = 16;
6264  }
6266 }
COB_EXPIMP void cob_file_return ( cob_file )

References cob_file_sort_retrieve(), COB_STATUS_00_SUCCESS, COB_STATUS_10_END_OF_FILE, COB_STATUS_30_PERMANENT_ERROR, COBSORTEND, cob_field::data, cob_file::file, cobsort::fnstatus, likely, NULL, cob_file::record, save_status(), and cobsort::sort_return.

6270 {
6271  struct cobsort *hp;
6273  int ret;
6274 
6275  fnstatus = NULL;
6276  hp = f->file;
6277  if (likely(hp)) {
6278  fnstatus = hp->fnstatus;
6279  }
6280  ret = cob_file_sort_retrieve (f, f->record->data);
6281  switch (ret) {
6282  case 0:
6283  save_status (f, fnstatus, COB_STATUS_00_SUCCESS);
6284  return;
6285  case COBSORTEND:
6286  save_status (f, fnstatus, COB_STATUS_10_END_OF_FILE);
6287  return;
6288  }
6289  if (likely(hp)) {
6290  *(int *)(hp->sort_return) = 16;
6291  }
6293 }
COB_EXPIMP void cob_file_sort_close ( cob_file )

References cob_free(), cob_free_list(), COB_STATUS_00_SUCCESS, cobsort::file, cob_file::file, cobsort::fnstatus, file_struct::fp, cob_file::keys, likely, NULL, and save_status().

6221 {
6222  struct cobsort *hp;
6224  size_t i;
6225 
6226  fnstatus = NULL;
6227  hp = f->file;
6228  if (likely(hp)) {
6229  fnstatus = hp->fnstatus;
6230  cob_free_list (hp);
6231  for (i = 0; i < 4; ++i) {
6232  if (hp->file[i].fp != NULL) {
6233  fclose (hp->file[i].fp);
6234  }
6235  }
6236  cob_free (hp);
6237  }
6238  if (f->keys) {
6239  cob_free (f->keys);
6240  }
6241  f->file = NULL;
6242  save_status (f, fnstatus, COB_STATUS_00_SUCCESS);
6243 }
COB_EXPIMP void cob_file_sort_giving ( cob_file ,
const size_t  ,
  ... 
)

References cob_close(), COB_CLOSE_NORMAL, cob_copy_check(), cob_file_sort_retrieve(), COB_FILE_SPECIAL, cob_free(), cob_malloc(), cob_open(), COB_OPEN_OUTPUT, COB_ORG_LINE_SEQUENTIAL, cob_write(), COB_WRITE_BEFORE, COB_WRITE_LINES, COBSORTEND, cob_field::data, cob_file::file, cob_file::file_status, NULL, cob_file::organization, cob_file::record, cob_file::record_max, cob_field::size, and cobsort::sort_return.

6115 {
6116  cob_file **fbase;
6117  struct cobsort *hp;
6118  size_t i;
6119  int ret;
6120  int opt;
6121  va_list args;
6122 
6123  fbase = cob_malloc (varcnt * sizeof(cob_file *));
6124  va_start (args, varcnt);
6125  for (i = 0; i < varcnt; ++i) {
6126  fbase[i] = va_arg (args, cob_file *);
6127  }
6128  va_end (args);
6129  for (i = 0; i < varcnt; ++i) {
6130  cob_open (fbase[i], COB_OPEN_OUTPUT, 0, NULL);
6131  }
6132  for (;;) {
6133  ret = cob_file_sort_retrieve (sort_file, sort_file->record->data);
6134  if (ret) {
6135  if (ret == COBSORTEND) {
6136  sort_file->file_status[0] = '1';
6137  sort_file->file_status[1] = '0';
6138  } else {
6139  hp = sort_file->file;
6140  *(int *)(hp->sort_return) = 16;
6141  sort_file->file_status[0] = '3';
6142  sort_file->file_status[1] = '0';
6143  }
6144  break;
6145  }
6146  for (i = 0; i < varcnt; ++i) {
6147  if (COB_FILE_SPECIAL (fbase[i]) ||
6148  fbase[i]->organization == COB_ORG_LINE_SEQUENTIAL) {
6149  opt = COB_WRITE_BEFORE | COB_WRITE_LINES | 1;
6150  } else {
6151  opt = 0;
6152  }
6153  fbase[i]->record->size = fbase[i]->record_max;
6154  cob_copy_check (fbase[i], sort_file);
6155  cob_write (fbase[i], fbase[i]->record, opt, NULL, 0);
6156  }
6157  }
6158  for (i = 0; i < varcnt; ++i) {
6159  cob_close (fbase[i], NULL, COB_CLOSE_NORMAL, 0);
6160  }
6161  cob_free (fbase);
6162 }
COB_EXPIMP void cob_file_sort_init ( cob_file ,
const unsigned  int,
const unsigned char *  ,
void *  ,
cob_field  
)

References cobsort::alloc_size, cobsort::chunk_size, cob_fast_malloc(), cob_malloc(), COB_MODULE_PTR, cob_sort_chunk, COB_STATUS_00_SUCCESS, cob_file::file, cobsort::fnstatus, cob_file::keys, cobsort::mem_base, sort_mem_struct::mem_ptr, cobsort::mem_size, cobsort::mem_total, sort_mem_struct::next, cob_file::nkeys, NULL, p, cobsort::pointer, cobsort::r_size, cob_file::record_max, save_status(), cobsort::size, cob_file::sort_collating, cobsort::sort_return, and cobsort::w_size.

6168 {
6169  struct cobsort *p;
6170  size_t n;
6171 
6172  p = cob_malloc (sizeof (struct cobsort));
6173  p->fnstatus = fnstatus;
6174  p->size = f->record_max;
6175  p->r_size = f->record_max + sizeof(size_t);
6176  p->w_size = f->record_max + sizeof(size_t) + 1;
6177  n = sizeof (struct cobitem) - offsetof (struct cobitem, item);
6178  if (f->record_max <= n) {
6179  p->alloc_size = sizeof (struct cobitem);
6180  } else {
6181  p->alloc_size = offsetof (struct cobitem, item) + f->record_max;
6182  }
6183  if (p->alloc_size % sizeof(void *)) {
6184  p->alloc_size += sizeof(void *) - (p->alloc_size % sizeof(void *));
6185  }
6187  if (p->chunk_size % p->alloc_size) {
6188  p->chunk_size += p->alloc_size - (p->chunk_size % p->alloc_size);
6189  }
6190  p->pointer = f;
6191  p->sort_return = sort_return;
6192  *(int *)sort_return = 0;
6193  p->mem_base = cob_fast_malloc (sizeof (struct sort_mem_struct));
6195  p->mem_base->next = NULL;
6196  p->mem_size = p->chunk_size;
6197  p->mem_total = p->chunk_size;
6198  f->file = p;
6199  f->keys = cob_malloc (sizeof (cob_file_key) * nkeys);
6200  f->nkeys = 0;
6201  if (collating_sequence) {
6202  f->sort_collating = collating_sequence;
6203  } else {
6204  f->sort_collating = COB_MODULE_PTR->collating_sequence;
6205  }
6206  save_status (f, fnstatus, COB_STATUS_00_SUCCESS);
6207 }
COB_EXPIMP void cob_file_sort_init_key ( cob_file ,
cob_field ,
const int  ,
const unsigned  int 
)

References cob_file_key::field, cob_file_key::flag, cob_file::keys, cob_file::nkeys, and cob_file_key::offset.

6212 {
6213  f->keys[f->nkeys].field = field;
6214  f->keys[f->nkeys].flag = flag;
6215  f->keys[f->nkeys].offset = offset;
6216  f->nkeys++;
6217 }
COB_EXPIMP void cob_file_sort_using ( cob_file ,
cob_file  
)

References cob_close(), COB_CLOSE_NORMAL, cob_copy_check(), cob_file_sort_submit(), cob_open(), COB_OPEN_INPUT, COB_READ_NEXT, cob_read_next(), cob_field::data, cob_file::file_status, NULL, and cob_file::record.

6095 {
6096  int ret;
6097 
6098  cob_open (data_file, COB_OPEN_INPUT, 0, NULL);
6099  for (;;) {
6100  cob_read_next (data_file, NULL, COB_READ_NEXT);
6101  if (data_file->file_status[0] != '0') {
6102  break;
6103  }
6104  cob_copy_check (sort_file, data_file);
6105  ret = cob_file_sort_submit (sort_file, sort_file->record->data);
6106  if (ret) {
6107  break;
6108  }
6109  }
6110  cob_close (data_file, NULL, COB_CLOSE_NORMAL, 0);
6111 }
COB_EXPIMP void cob_free ( void *  )

References cob_fatal_error(), COB_FERROR_FREE, and unlikely.

1135 {
1136 #ifdef _DEBUG
1137  if (unlikely(!mptr)) {
1138  cob_fatal_error (COB_FERROR_FREE);
1139  }
1140 #endif
1141  free (mptr);
1142 
1143 }
COB_EXPIMP void cob_free_alloc ( unsigned char **  ,
unsigned char *   
)

References cob_alloc_base, COB_EC_STORAGE_NOT_ALLOC, __cob_global::cob_exception_code, cob_free(), cob_alloc_cache::cob_pointer, cob_set_exception(), cob_alloc_cache::next, and NULL.

2791 {
2792  struct cob_alloc_cache *cache_ptr;
2793  struct cob_alloc_cache *prev_ptr;
2794  void *vptr1;
2795 
2796  /* FREE */
2798  cache_ptr = cob_alloc_base;
2799  prev_ptr = cob_alloc_base;
2800  if (ptr1 && *ptr1) {
2801  vptr1 = *ptr1;
2802  for (; cache_ptr; cache_ptr = cache_ptr->next) {
2803  if (vptr1 == cache_ptr->cob_pointer) {
2804  cob_free (cache_ptr->cob_pointer);
2805  if (cache_ptr == cob_alloc_base) {
2806  cob_alloc_base = cache_ptr->next;
2807  } else {
2808  prev_ptr->next = cache_ptr->next;
2809  }
2810  cob_free (cache_ptr);
2811  *ptr1 = NULL;
2812  return;
2813  }
2814  prev_ptr = cache_ptr;
2815  }
2817  return;
2818  }
2819  if (ptr2 && *(void **)ptr2) {
2820  for (; cache_ptr; cache_ptr = cache_ptr->next) {
2821  if (*(void **)ptr2 == cache_ptr->cob_pointer) {
2822  cob_free (cache_ptr->cob_pointer);
2823  if (cache_ptr == cob_alloc_base) {
2824  cob_alloc_base = cache_ptr->next;
2825  } else {
2826  prev_ptr->next = cache_ptr->next;
2827  }
2828  cob_free (cache_ptr);
2829  *(void **)ptr2 = NULL;
2830  return;
2831  }
2832  prev_ptr = cache_ptr;
2833  }
2835  return;
2836  }
2837 }
COB_EXPIMP int cob_func ( const char *  ,
const int  ,
void **   
)

References cob_call(), and cob_cancel().

1132 {
1133  int ret;
1134 
1135  ret = cob_call (name, argc, argv);
1136  cob_cancel (name);
1137  return ret;
1138 }
COB_EXPIMP void cob_get_environment ( const cob_field ,
cob_field  
)

References COB_EC_IMP_ACCEPT, __cob_global::cob_env_mangle, cob_field_to_string(), cob_free(), cob_malloc(), cob_memcpy(), cob_set_exception(), p, cob_field::size, and unlikely.

2685 {
2686  const char *p;
2687  char *buff;
2688  size_t size;
2689 
2690  if (envname->size == 0 || envval->size == 0) {
2692  return;
2693  }
2694 
2695  buff = cob_malloc (envname->size + 1U);
2696  cob_field_to_string (envname, buff, envname->size);
2698  for (size = 0; size < strlen (buff); ++size) {
2699  if (!isalnum ((int)buff[size])) {
2700  buff[size] = '_';
2701  }
2702  }
2703  }
2704  p = getenv (buff);
2705  if (!p) {
2707  p = " ";
2708  }
2709  cob_memcpy (envval, p, strlen (p));
2710  cob_free (buff);
2711 }
COB_EXPIMP cob_global* cob_get_global_ptr ( void  )

References cob_fatal_error(), COB_FERROR_INITIALIZED, cob_initialized, cobglobptr, and unlikely.

1568 {
1569  if (unlikely(!cob_initialized)) {
1570  cob_fatal_error (COB_FERROR_INITIALIZED);
1571  }
1572  return cobglobptr;
1573 }
COB_EXPIMP void cob_get_indirect_field ( cob_field )

References cob_move().

2068 {
2069  cob_move (move_field, f);
2070 }
COB_EXPIMP int cob_get_int ( cob_field )

References cob_field::attr, COB_ATTR_INIT, cob_binary_mget_sint64(), cob_display_get_int(), COB_FIELD_SCALE, COB_FIELD_TYPE, COB_FLAG_HAVE_SIGN, cob_move(), cob_packed_get_int(), cob_s64_t, COB_TYPE_NUMERIC_BINARY, COB_TYPE_NUMERIC_DISPLAY, COB_TYPE_NUMERIC_PACKED, cob_field::data, NULL, and cob_field::size.

1626 {
1627  int n;
1628  cob_s64_t val;
1629  cob_field temp;
1630  cob_field_attr attr;
1631 
1632  switch (COB_FIELD_TYPE (f)) {
1634  return cob_display_get_int (f);
1636  return cob_packed_get_int (f);
1638  val = cob_binary_mget_sint64 (f);
1639  for (n = COB_FIELD_SCALE (f); n > 0 && val; --n) {
1640  val /= 10;
1641  }
1642  return (int)val;
1643  default:
1644  COB_ATTR_INIT (COB_TYPE_NUMERIC_BINARY, 9, 0,
1645  COB_FLAG_HAVE_SIGN, NULL);
1646  temp.size = 4;
1647  temp.data = (unsigned char *)&n;
1648  temp.attr = &attr;
1649  cob_move (f, &temp);
1650  return n;
1651  }
1652 }
COB_EXPIMP cob_s64_t cob_get_llint ( cob_field )

References cob_field::attr, cob_binary_mget_sint64(), cob_display_get_long_long(), COB_FIELD_SCALE, COB_FIELD_TYPE, cob_move(), cob_packed_get_long_long(), cob_s64_t, COB_TYPE_NUMERIC_BINARY, COB_TYPE_NUMERIC_DISPLAY, COB_TYPE_NUMERIC_PACKED, const_binll_attr, cob_field::data, and cob_field::size.

1656 {
1657  cob_s64_t n;
1658  int inc;
1659  cob_field temp;
1660 
1661  switch (COB_FIELD_TYPE (f)) {
1663  return cob_display_get_long_long (f);
1665  return cob_packed_get_long_long (f);
1667  n = cob_binary_mget_sint64 (f);
1668  for (inc = COB_FIELD_SCALE (f); inc > 0 && n; --inc) {
1669  n /= 10;
1670  }
1671  return n;
1672  default:
1673  temp.size = 8;
1674  temp.data = (unsigned char *)&n;
1675  temp.attr = &const_binll_attr;
1676  cob_move (f, &temp);
1677  return n;
1678  }
1679 }
COB_EXPIMP unsigned char* cob_get_pointer ( const void *  )

References cob_u8_ptr.

1317 {
1318  void *tmptr;
1319 
1320  memcpy (&tmptr, srcptr, sizeof (void *));
1321  return (cob_u8_ptr)tmptr;
1322 }
COB_EXPIMP void* cob_get_prog_pointer ( const void *  )
1326 {
1327  void *tmptr;
1328 
1329  memcpy (&tmptr, srcptr, sizeof (void *));
1330  return tmptr;
1331 }
COB_EXPIMP int cob_get_switch ( const int  )

References cob_switch, and COB_SWITCH_MAX.

2077 {
2078  if (n < 0 || n > (COB_SWITCH_MAX - 1)) {
2079  return 0;
2080  }
2081  return cob_switch[n];
2082 }
COB_EXPIMP char* cob_getenv ( const char *  )

References cob_strdup(), NULL, and p.

2841 {
2842  char *p;
2843 
2844  if (name) {
2845  p = getenv (name);
2846  if (p) {
2847  return cob_strdup (p);
2848  }
2849  }
2850  return NULL;
2851 }
COB_EXPIMP void cob_gmp_free ( void *  )

References NULL.

217  {
218 /* mpir/gmp free functions */
219 #ifdef HAVE_MP_GET_MEMORY_FUNCTIONS
220  void (*freefunc)(void *, size_t);
221  mp_get_memory_functions (NULL, NULL, &freefunc);
222  freefunc (ptr, strlen((char*) ptr) + 1);
223 #else
224  free (ptr);
225 #endif
226 }
COB_EXPIMP void cob_incr_temp_iteration ( void  )

References cob_temp_iteration.

2926 {
2928 }
COB_EXPIMP void cob_init ( const int  ,
char **   
)

References _, cob_argc, cob_argv, cob_check_env_true(), cob_current_paragraph, cob_current_program_id, cob_current_section, __cob_global::cob_display_warn, runtime_env::cob_display_warn_env, __cob_global::cob_env_mangle, runtime_env::cob_env_mangle_env, COB_ERRBUF_SIZE, cob_fast_malloc(), __cob_global::cob_first_init, cob_free(), cob_init_call(), cob_init_fileio(), cob_init_intrinsic(), cob_init_move(), cob_init_numeric(), cob_init_screenio(), cob_init_strings(), cob_init_termio(), cob_initialized, COB_LARGE_BUFF, COB_LARGE_MAX, cob_last_sfile, cob_line_trace, runtime_env::cob_line_trace_env, cob_local_env, cob_local_env_size, __cob_global::cob_locale, __cob_global::cob_locale_collate, __cob_global::cob_locale_ctype, __cob_global::cob_locale_messages, __cob_global::cob_locale_monetary, __cob_global::cob_locale_numeric, __cob_global::cob_locale_orig, __cob_global::cob_locale_time, __cob_global::cob_main_argv0, cob_malloc(), COB_MEDIUM_BUFF, cob_rescan_env_vals(), cob_save_env_value(), cob_set_signal(), cob_source_file, cob_source_line, cob_source_statement, cob_strdup(), cob_switch, COB_SWITCH_MAX, __cob_global::cob_term_buff, cob_trace_env, cob_trace_file, __cob_global::cob_unix_lf, runtime_env::cob_unix_lf_env, cob_user_name, commlncnt, commlnptr, current_arg, exit_hdlrs, hdlrs, NULL, R_OK, runtime_err_str, sort_collate, and sort_nkeys.

4252 {
4253  char *s;
4254 #if defined(HAVE_READLINK) || defined(HAVE_GETEXECNAME)
4255  const char *path;
4256 #endif
4257  int i;
4258 
4259  if (cob_initialized) {
4260  return;
4261  }
4262 
4263  cobglobptr = NULL;
4264  runtimeptr = (struct runtime_env*) cob_malloc(sizeof(struct runtime_env));
4265 
4266  cob_set_signal ();
4267 
4268  cob_alloc_base = NULL;
4269  cob_local_env = NULL;
4270  cob_last_sfile = NULL;
4271  commlnptr = NULL;
4272  basext = NULL;
4273  sort_keys = NULL;
4274  sort_collate = NULL;
4280  cob_user_name = NULL;
4281  exit_hdlrs = NULL;
4282  hdlrs = NULL;
4283  commlncnt = 0;
4284  sort_nkeys = 0;
4285  cob_source_line = 0;
4286  cob_line_trace = 0;
4287  cob_local_env_size = 0;
4288 
4289  current_arg = 1;
4290 
4291  cob_argc = argc;
4292  cob_argv = argv;
4293 
4294  /* Get emergency buffer */
4296 
4297  /* Get global structure */
4298  cobglobptr = cob_malloc (sizeof(cob_global));
4299 
4300  cob_initialized = 1;
4301 
4302  if (argc) {
4304  }
4305 
4306 #ifdef HAVE_SETLOCALE
4307  /* Prime the locale from user settings */
4308  s = setlocale (LC_ALL, "");
4309  if (s) {
4310  /* Save initial values */
4312  s = setlocale (LC_CTYPE, NULL);
4313  if (s) {
4315  }
4316  s = setlocale (LC_COLLATE, NULL);
4317  if (s) {
4319  }
4320 #ifdef LC_MESSAGES
4321  s = setlocale (LC_MESSAGES, NULL);
4322  if (s) {
4324  }
4325 #endif
4326  s = setlocale (LC_MONETARY, NULL);
4327  if (s) {
4329  }
4330  s = setlocale (LC_NUMERIC, NULL);
4331  if (s) {
4333  }
4334  s = setlocale (LC_TIME, NULL);
4335  if (s) {
4337  }
4338  /* Set to standard "C" locale for COBOL */
4339  setlocale (LC_NUMERIC, "C");
4340  setlocale (LC_CTYPE, "C");
4341  /* Save changed locale */
4342  s = setlocale (LC_ALL, NULL);
4343  if (s) {
4345  }
4346  }
4347 #endif
4348 
4349 #ifdef _WIN32
4350  /* Allows running of tests under Win */
4351  s = getenv ("COB_UNIX_LF");
4352  if (s) {
4354 
4355  if (cob_check_env_true(s)) {
4356 
4357  cobglobptr->cob_unix_lf = 1;
4358  _setmode (_fileno (stdin), _O_BINARY);
4359  _setmode (_fileno (stdout), _O_BINARY);
4360  _setmode (_fileno (stderr), _O_BINARY);
4361  }
4362  }
4363 #endif
4364 
4365  /* Call inits with runtimeptr to get the adresses of all */
4367  cob_init_strings();
4370  /* Screen-IO might be needed for error outputs */
4375 
4376  /* Set up library routine stuff */
4377  cobglobptr->cob_term_buff = cob_malloc ((size_t)COB_MEDIUM_BUFF);
4379 
4380  /* Set switches */
4381  for (i = 0; i < COB_SWITCH_MAX; ++i) {
4382  sprintf (runtime_err_str, "COB_SWITCH_%d", i);
4383  s = getenv (runtime_err_str);
4384  if (s && (*s == '1' || strcasecmp (s, "ON") == 0)) {
4385  cob_switch[i] = 1;
4386  } else {
4387  cob_switch[i] = 0;
4388  }
4389  }
4390 
4391  /* Trace enable */
4392  s = getenv ("COB_SET_TRACE");
4393  if (s) {
4395 
4396  if (cob_check_env_true(s)) {
4397  cob_line_trace = 1;
4398  }
4399  }
4400 
4401  /* Trace file */
4402  s = getenv ("COB_TRACE_FILE");
4403  if (s) {
4404  cob_trace_env = (const char*) cob_save_env_value((char*) cob_trace_env, s);
4405  cob_trace_file = NULL;
4406  } else {
4407  cob_trace_env = NULL;
4408  cob_trace_file = stderr;
4409  }
4410 
4411  /* Disable runtime warnings */
4413  s = getenv ("COB_DISABLE_WARNINGS");
4414  if (s) {
4416 
4417  if (cob_check_env_true(s)) {
4419  }
4420  }
4421 
4422  /* Mangle environment names */
4423  s = getenv ("COB_ENV_MANGLE");
4424  if (s) {
4426 
4427  if (cob_check_env_true(s)) {
4429  }
4430  }
4431 
4432  /* Get user name */
4433  s = getenv ("USERNAME");
4434  if (s) {
4435  cob_user_name = cob_strdup (s);
4436  } else {
4437  s = getenv ("LOGNAME");
4438  if (s) {
4439  cob_user_name = cob_strdup (s);
4440  } else {
4441 #ifdef _WIN32
4442  unsigned long bsiz = COB_ERRBUF_SIZE;
4443  if (GetUserName (runtime_err_str, &bsiz)) {
4445  }
4446 #elif !defined(__OS400__)
4447  s = getlogin ();
4448  if (s) {
4449  cob_user_name = cob_strdup (s);
4450  }
4451 #endif
4452  }
4453  }
4454  if (!cob_user_name) {
4455  cob_user_name = cob_strdup (_("Unknown"));
4456  }
4457 
4458  /* This must be last in this function as we do early return */
4459  /* from certain ifdef's */
4460 
4461 #ifdef _WIN32
4462  s = cob_malloc ((size_t)COB_LARGE_BUFF);
4463  i = GetModuleFileNameA (NULL, s, COB_LARGE_MAX);
4464  if (i > 0 && i < COB_LARGE_BUFF) {
4466  cob_free (s);
4467  return;
4468  }
4469  cob_free (s);
4470 #elif defined(HAVE_READLINK)
4471  path = NULL;
4472  if (!access ("/proc/self/exe", R_OK)) {
4473  path = "/proc/self/exe";
4474  } else if (!access ("/proc/curproc/file", R_OK)) {
4475  path = "/proc/curproc/file";
4476  } else if (!access ("/proc/self/path/a.out", R_OK)) {
4477  path = "/proc/self/path/a.out";
4478  }
4479  if (path) {
4480  s = cob_malloc ((size_t)COB_LARGE_BUFF);
4481  i = (int)readlink (path, s, (size_t)COB_LARGE_MAX);
4482  if (i > 0 && i < COB_LARGE_BUFF) {
4484  cob_free (s);
4485  return;
4486  }
4487  cob_free (s);
4488  }
4489 #endif
4490 
4491 #ifdef HAVE_GETEXECNAME
4492  path = getexecname ();
4493  if (path) {
4494 #ifdef HAVE_REALPATH
4495  s = cob_malloc ((size_t)COB_LARGE_BUFF);
4496  if (realpath (path, s) != NULL) {
4498  } else {
4500  }
4501  cob_free (s);
4502 #else
4504 #endif
4505  return;
4506  }
4507 #endif
4508 
4509  if (argc && argv && argv[0]) {
4510 #ifdef _WIN32
4511  /* Returns malloced path or NULL */
4512  cobglobptr->cob_main_argv0 = _fullpath (NULL, argv[0], 1);
4513 #elif defined(HAVE_CANONICALIZE_FILE_NAME)
4514  /* Returns malloced path or NULL */
4515  cobglobptr->cob_main_argv0 = canonicalize_file_name (argv[0]);
4516 #elif defined(HAVE_REALPATH)
4517  s = cob_malloc ((size_t)COB_LARGE_BUFF);
4518  if (realpath (argv[0], s) != NULL) {
4520  }
4521  cob_free (s);
4522 #endif
4523  if (!cobglobptr->cob_main_argv0) {
4524  cobglobptr->cob_main_argv0 = cob_strdup (argv[0]);
4525  }
4526  } else {
4527  cobglobptr->cob_main_argv0 = cob_strdup (_("Unknown"));
4528  }
4529  /* The above must be last in this function as we do early return */
4530  /* from certain ifdef's */
4531 }
COB_EXPIMP void cob_inspect_after ( const cob_field )

References cob_field::data, inspect_end, inspect_start, p, and cob_field::size.

284 {
285  unsigned char *p;
286 
287  for (p = inspect_start; p < inspect_end - str->size + 1; ++p) {
288  if (memcmp (p, str->data, str->size) == 0) {
289  inspect_start = p + str->size;
290  return;
291  }
292  }
294 }
COB_EXPIMP void cob_inspect_all ( cob_field ,
cob_field  
)

References INSPECT_ALL, and inspect_common().

330 {
331  inspect_common (f1, f2, INSPECT_ALL);
332 }
COB_EXPIMP void cob_inspect_before ( const cob_field )

References cob_field::data, inspect_end, inspect_start, p, and cob_field::size.

271 {
272  unsigned char *p;
273 
274  for (p = inspect_start; p < inspect_end - str->size + 1; ++p) {
275  if (memcmp (p, str->data, str->size) == 0) {
276  inspect_end = p;
277  return;
278  }
279  }
280 }
COB_EXPIMP void cob_inspect_characters ( cob_field )

References cob_add_int(), cob_field::data, inspect_data, inspect_end, inspect_mark, inspect_replacing, and inspect_start.

298 {
299  int *mark;
300  int i;
301  int n;
302  int len;
303 
305  len = (int)(inspect_end - inspect_start);
306  if (inspect_replacing) {
307  /* INSPECT REPLACING CHARACTERS f1 */
308  for (i = 0; i < len; ++i) {
309  if (mark[i] == -1) {
310  mark[i] = f1->data[0];
311  }
312  }
313  } else {
314  /* INSPECT TALLYING f1 CHARACTERS */
315  n = 0;
316  for (i = 0; i < len; ++i) {
317  if (mark[i] == -1) {
318  mark[i] = 1;
319  n++;
320  }
321  }
322  if (n > 0) {
323  cob_add_int (f1, n, 0);
324  }
325  }
326 }
COB_EXPIMP void cob_inspect_converting ( const cob_field ,
const cob_field  
)

References alloc_figurative(), alpha_fld, COB_FIELD_TYPE, cob_set_exception(), COB_TYPE_ALPHANUMERIC_ALL, cob_field::data, inspect_end, inspect_mark, inspect_start, cob_field::size, str_cob_low, and unlikely.

354 {
355  size_t i;
356  size_t j;
357  size_t len;
358 
359  if (unlikely(!f1)) {
360  f1 = &str_cob_low;
361  }
362  if (unlikely(!f2)) {
363  f2 = &str_cob_low;
364  }
365  if (f1->size != f2->size) {
366  if (COB_FIELD_TYPE (f2) == COB_TYPE_ALPHANUMERIC_ALL) {
367  alloc_figurative (f2, f1);
368  f2 = &alpha_fld;
369  } else {
370  cob_set_exception (COB_EC_RANGE_INSPECT_SIZE);
371  return;
372  }
373  }
374 
375  len = (size_t)(inspect_end - inspect_start);
376  for (j = 0; j < f1->size; ++j) {
377  for (i = 0; i < len; ++i) {
378  if (inspect_mark[i] == -1 &&
379  inspect_start[i] == f1->data[j]) {
380  inspect_start[i] = f2->data[j];
381  inspect_mark[i] = 1;
382  }
383  }
384  }
385 }
COB_EXPIMP void cob_inspect_finish ( void  )

References COB_PUT_SIGN, inspect_data, inspect_mark, inspect_replacing, inspect_sign, inspect_size, and unlikely.

389 {
390  size_t i;
391 
392  if (inspect_replacing) {
393  for (i = 0; i < inspect_size; ++i) {
394  if (inspect_mark[i] != -1) {
395  inspect_data[i] = inspect_mark[i];
396  }
397  }
398  }
399 
400  if (unlikely(inspect_var)) {
402  }
403 }
COB_EXPIMP void cob_inspect_first ( cob_field ,
cob_field  
)

References inspect_common(), and INSPECT_FIRST.

342 {
343  inspect_common (f1, f2, INSPECT_FIRST);
344 }
COB_EXPIMP void cob_inspect_init ( cob_field ,
const cob_u32_t   
)

References cob_fast_malloc(), COB_FIELD_DATA, COB_FIELD_IS_NUMDISP, COB_FIELD_SIZE, cob_free(), COB_GET_SIGN, cob_set_exception(), inspect_data, inspect_end, inspect_mark, inspect_mark_size, inspect_replacing, inspect_sign, inspect_size, inspect_start, inspect_var_copy, NULL, and unlikely.

232 {
233  size_t i;
234  size_t digcount;
235 
236  if (unlikely(COB_FIELD_IS_NUMDISP (var))) {
237  inspect_var_copy = *var;
239  inspect_sign = COB_GET_SIGN (var);
240  } else {
241  inspect_var = NULL;
242  }
245  inspect_replacing = replacing;
247  inspect_end = NULL;
248  digcount = inspect_size * sizeof (int);
249  if (digcount > inspect_mark_size) {
250  if (inspect_mark) {
252  }
253  inspect_mark = cob_fast_malloc (digcount);
254  inspect_mark_size = digcount;
255  }
256  for (i = 0; i < inspect_size; ++i) {
257  inspect_mark[i] = -1;
258  }
259  cob_set_exception (0);
260 }
COB_EXPIMP void cob_inspect_leading ( cob_field ,
cob_field  
)

References inspect_common(), and INSPECT_LEADING.

336 {
338 }
COB_EXPIMP void cob_inspect_start ( void  )
COB_EXPIMP void cob_inspect_trailing ( cob_field ,
cob_field  
)

References inspect_common(), and INSPECT_TRAILING.

348 {
350 }
char* cob_int_to_formatted_bytestring ( int  ,
char *   
)

References cob_fast_malloc(), and NULL.

3845  {
3846 
3847  double d;
3848  char* strB;
3849 
3850  if(!number) return NULL;
3851 
3852  strB = (char*) cob_fast_malloc(3);
3853 
3854  if (i > (1024 * 1024)) {
3855  d = i / 1024.0 / 1024.0;
3856  strB = (char*) "MB";
3857  } else if (i > 1024) {
3858  d = i / 1024.0;
3859  strB = (char*) "kB";
3860  } else {
3861  d = 0;
3862  strB = (char*) "B";
3863  }
3864  sprintf(number, "%3.2f %s", d, strB);
3865  return number;
3866 }
char* cob_int_to_string ( int  ,
char *   
)

References NULL.

3838  {
3839  if(!number) return NULL;
3840  sprintf(number, "%i", i);
3841  return number;
3842 }
COB_EXPIMP cob_field* cob_intr_abs ( cob_field )

References cob_decimal_get_field(), cob_decimal_set_field(), curr_field, make_field_entry(), and cob_decimal::value.

3438 {
3439  cob_decimal_set_field (&d1, srcfield);
3440  mpz_abs (d1.value, d1.value);
3441 
3442  make_field_entry (srcfield);
3443  (void)cob_decimal_get_field (&d1, curr_field, 0);
3444  return curr_field;
3445 }
COB_EXPIMP cob_field* cob_intr_acos ( cob_field )

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_decimal_cmp(), cob_decimal_get_field(), cob_decimal_get_mpf(), cob_decimal_set_field(), cob_decimal_set_mpf(), COB_EC_ARGUMENT_FUNCTION, cob_mpf_acos(), cob_mpft, cob_set_exception(), curr_field, cob_decimal::scale, and cob_decimal::value.

3449 {
3450  cob_decimal_set_field (&d1, srcfield);
3451 
3452  mpz_set (d4.value, d1.value);
3453  mpz_set (d5.value, d1.value);
3454  d4.scale = d1.scale;
3455  d5.scale = d1.scale;
3456  mpz_set_si (d2.value, -1L);
3457  d2.scale = 0;
3458  mpz_set_ui (d3.value, 1UL);
3459  d3.scale = 0;
3460 
3461  cob_set_exception (0);
3462  if (cob_decimal_cmp (&d4, &d2) < 0 || cob_decimal_cmp (&d5, &d3) > 0) {
3465  return curr_field;
3466  }
3467 
3471  cob_alloc_field (&d1);
3472  (void)cob_decimal_get_field (&d1, curr_field, 0);
3473 
3474  return curr_field;
3475 }
COB_EXPIMP cob_field* cob_intr_annuity ( cob_field ,
cob_field  
)

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_decimal_add(), cob_decimal_div(), cob_decimal_get_field(), cob_decimal_pow(), cob_decimal_set_field(), cob_decimal_sub(), COB_EC_ARGUMENT_FUNCTION, cob_set_exception(), cob_trim_decimal(), curr_field, cob_decimal::scale, sign, and cob_decimal::value.

3892 {
3893  int sign;
3894 
3895  cob_decimal_set_field (&d1, srcfield1);
3896  cob_decimal_set_field (&d2, srcfield2);
3897 
3898  /* P1 >= 0, P2 > 0 and integer */
3899  sign = mpz_sgn (d1.value);
3900  if (sign < 0 || mpz_sgn (d2.value) <= 0 || d2.scale != 0) {
3903  return curr_field;
3904  }
3905 
3906  if (!sign) {
3907  mpz_set_ui (d1.value, 1UL);
3908  d1.scale = 0;
3909  cob_decimal_div (&d1, &d2);
3910  cob_alloc_field (&d1);
3911  (void)cob_decimal_get_field (&d1, curr_field, 0);
3912  return curr_field;
3913  }
3914 
3915  /* x = P1 / (1 - (1 + P1) ^ (-P2)) */
3916  mpz_neg (d2.value, d2.value);
3917 
3918  mpz_set (d3.value, d1.value);
3919  d3.scale = d1.scale;
3920  mpz_set_ui (d4.value, 1UL);
3921  d4.scale = 0;
3922  cob_decimal_add (&d3, &d4);
3923  cob_trim_decimal (&d3);
3924  cob_trim_decimal (&d2);
3925  cob_decimal_pow (&d3, &d2);
3926  mpz_set_ui (d4.value, 1UL);
3927  d4.scale = 0;
3928  cob_decimal_sub (&d4, &d3);
3929  cob_trim_decimal (&d4);
3930  cob_trim_decimal (&d1);
3931  cob_decimal_div (&d1, &d4);
3932  cob_alloc_field (&d1);
3933  (void)cob_decimal_get_field (&d1, curr_field, 0);
3934  return curr_field;
3935 }
COB_EXPIMP cob_field* cob_intr_asin ( cob_field )

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_decimal_cmp(), cob_decimal_get_field(), cob_decimal_get_mpf(), cob_decimal_set_field(), cob_decimal_set_mpf(), COB_EC_ARGUMENT_FUNCTION, cob_mpf_asin(), cob_mpft, cob_set_exception(), curr_field, cob_decimal::scale, and cob_decimal::value.

3479 {
3480  cob_decimal_set_field (&d1, srcfield);
3481 
3482  mpz_set (d4.value, d1.value);
3483  mpz_set (d5.value, d1.value);
3484  d4.scale = d1.scale;
3485  d5.scale = d1.scale;
3486  mpz_set_si (d2.value, -1L);
3487  d2.scale = 0;
3488  mpz_set_ui (d3.value, 1UL);
3489  d3.scale = 0;
3490 
3491  cob_set_exception (0);
3492  if (cob_decimal_cmp (&d4, &d2) < 0 || cob_decimal_cmp (&d5, &d3) > 0) {
3495  return curr_field;
3496  }
3497 
3498  if (!mpz_sgn (d1.value)) {
3499  /* Asin (0) = 0 */
3501  return curr_field;
3502  }
3503 
3507  cob_alloc_field (&d1);
3508  (void)cob_decimal_get_field (&d1, curr_field, 0);
3509 
3510  return curr_field;
3511 }
COB_EXPIMP cob_field* cob_intr_atan ( cob_field )

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_decimal_get_field(), cob_decimal_get_mpf(), cob_decimal_set_field(), cob_decimal_set_mpf(), cob_mpf_atan(), cob_mpft, cob_set_exception(), curr_field, and cob_decimal::value.

3515 {
3516  cob_decimal_set_field (&d1, srcfield);
3517 
3518  cob_set_exception (0);
3519 
3520  if (!mpz_sgn (d1.value)) {
3521  /* Atan (0) = 0 */
3523  return curr_field;
3524  }
3525 
3529  cob_alloc_field (&d1);
3530  (void)cob_decimal_get_field (&d1, curr_field, 0);
3531 
3532  return curr_field;
3533 }
COB_EXPIMP cob_field* cob_intr_binop ( cob_field ,
const int  ,
cob_field  
)

References cob_alloc_field(), cob_decimal_add(), cob_decimal_div(), cob_decimal_get_field(), cob_decimal_mul(), cob_decimal_pow(), cob_decimal_set_field(), cob_decimal_sub(), COB_EC_SIZE_ZERO_DIVIDE, cob_set_exception(), curr_field, cob_decimal::scale, and cob_decimal::value.

2174 {
2175  cob_decimal_set_field (&d1, f1);
2176  cob_decimal_set_field (&d2, f2);
2177  switch (op) {
2178  case '+':
2179  cob_decimal_add (&d1, &d2);
2180  break;
2181  case '-':
2182  cob_decimal_sub (&d1, &d2);
2183  break;
2184  case '*':
2185  cob_decimal_mul (&d1, &d2);
2186  break;
2187  case '/':
2188  cob_set_exception (0);
2189  if (!mpz_sgn (d2.value)) {
2190  /* Divide by zero */
2192  mpz_set_ui (d1.value, 0UL);
2193  d1.scale = 0;
2194  } else {
2195  cob_decimal_div (&d1, &d2);
2196  }
2197  break;
2198  case '^':
2199  cob_decimal_pow (&d1, &d2);
2200  break;
2201  default:
2202  break;
2203  }
2204 
2205  cob_alloc_field (&d1);
2206  (void)cob_decimal_get_field (&d1, curr_field, 0);
2207  return curr_field;
2208 }
COB_EXPIMP cob_field* cob_intr_boolean_of_integer ( cob_field ,
cob_field  
)

References cob_fatal_error(), COB_FERROR_FUNCTION, and COB_UNUSED.

5738 {
5739  COB_UNUSED (f1);
5740  COB_UNUSED (f2);
5741 
5742  cob_fatal_error (COB_FERROR_FUNCTION);
5743 }
COB_EXPIMP cob_field* cob_intr_byte_length ( cob_field )

References cob_alloc_set_field_uint(), cob_u32_t, curr_field, and cob_field::size.

2225 {
2226  cob_alloc_set_field_uint ((cob_u32_t)srcfield->size);
2227  return curr_field;
2228 }
COB_EXPIMP cob_field* cob_intr_char ( cob_field )

References COB_FIELD_INIT, cob_get_int(), curr_field, cob_field::data, make_field_entry(), and NULL.

2964 {
2965  int i;
2966  cob_field field;
2967 
2969  make_field_entry (&field);
2970 
2971  i = cob_get_int (srcfield);
2972  if (i < 1 || i > 256) {
2973  *curr_field->data = 0;
2974  } else {
2975  *curr_field->data = i - 1;
2976  }
2977  return curr_field;
2978 }
COB_EXPIMP cob_field* cob_intr_char_national ( cob_field )

References cob_fatal_error(), COB_FERROR_FUNCTION, and COB_UNUSED.

5747 {
5748  COB_UNUSED (srcfield);
5749 
5750  cob_fatal_error (COB_FERROR_FUNCTION);
5751 }
COB_EXPIMP cob_field* cob_intr_combined_datetime ( cob_field ,
cob_field  
)

References COB_ATTR_INIT, COB_EC_ARGUMENT_FUNCTION, COB_FIELD_INIT, cob_get_int(), cob_set_exception(), COB_TYPE_NUMERIC_DISPLAY, curr_field, cob_field::data, make_field_entry(), NULL, valid_integer_date(), and valid_time().

3007 {
3008  int srdays;
3009  int srtime;
3010  cob_field_attr attr;
3011  cob_field field;
3012  char buff[16];
3013 
3014  COB_ATTR_INIT (COB_TYPE_NUMERIC_DISPLAY, 12, 5, 0, NULL);
3015  COB_FIELD_INIT (12, NULL, &attr);
3016  make_field_entry (&field);
3017 
3018  cob_set_exception (0);
3019  srdays = cob_get_int (srcdays);
3020  if (!valid_integer_date (srdays)) {
3022  memset (curr_field->data, '0', (size_t)12);
3023  return curr_field;
3024  }
3025  srtime = cob_get_int (srctime);
3026  if (!valid_time (srtime)) {
3028  memset (curr_field->data, '0', (size_t)12);
3029  return curr_field;
3030  }
3031  snprintf (buff, (size_t)15, "%7.7d%5.5d", srdays, srtime);
3032  memcpy (curr_field->data, buff, (size_t)12);
3033  return curr_field;
3034 }
COB_EXPIMP cob_field* cob_intr_concatenate ( const int  ,
const int  ,
const int  ,
  ... 
)

References calc_ref_mod(), COB_FIELD_INIT, cob_free(), cob_malloc(), curr_field, cob_field::data, make_field_entry(), NULL, p, params, cob_field::size, and unlikely.

2469 {
2470  cob_field **f;
2471  unsigned char *p;
2472  size_t calcsize;
2473  int i;
2474  cob_field field;
2475  va_list args;
2476 
2477  f = cob_malloc ((size_t)params * sizeof (cob_field *));
2478 
2479  va_start (args, params);
2480 
2481  /* Extract args / calculate size */
2482  calcsize = 0;
2483  for (i = 0; i < params; ++i) {
2484  f[i] = va_arg (args, cob_field *);
2485  calcsize += f[i]->size;
2486  }
2487  va_end (args);
2488 
2489  COB_FIELD_INIT (calcsize, NULL, &const_alpha_attr);
2490  make_field_entry (&field);
2491 
2492  p = curr_field->data;
2493  for (i = 0; i < params; ++i) {
2494  memcpy (p, f[i]->data, f[i]->size);
2495  p += f[i]->size;
2496  }
2497 
2498  if (unlikely(offset > 0)) {
2499  calc_ref_mod (curr_field, offset, length);
2500  }
2501  cob_free (f);
2502  return curr_field;
2503 }
COB_EXPIMP cob_field* cob_intr_currency_symbol ( void  )

References COB_FIELD_INIT, COB_MODULE_PTR, cob_set_exception(), curr_field, cob_field::data, make_field_entry(), NULL, p, and cob_field::size.

5211 {
5212 #ifdef HAVE_LOCALECONV
5213  struct lconv *p;
5214  size_t size;
5215 #endif
5216  cob_field field;
5217 
5219  cob_set_exception (0);
5220 
5221 #ifdef HAVE_LOCALECONV
5222  p = localeconv ();
5223  size = strlen (p->currency_symbol);
5224  if (size) {
5225  field.size = size;
5226  } else {
5227  field.size = 1;
5228  }
5229  make_field_entry (&field);
5230  if (size) {
5231  memcpy (curr_field->data, p->currency_symbol, size);
5232  } else {
5233  curr_field->size = 0;
5234  curr_field->data[0] = 0;
5235  }
5236 #else
5237  field.size = 1;
5238  make_field_entry (&field);
5239  curr_field->data[0] = COB_MODULE_PTR->currency_symbol;
5240 #endif
5241  return curr_field;
5242 }
COB_EXPIMP cob_field* cob_intr_current_date ( const int  ,
const int   
)

References calc_ref_mod(), COB_FIELD_INIT, curr_field, cob_field::data, make_field_entry(), NULL, and unlikely.

2869 {
2870 #if defined(_WIN32) && !defined(__CYGWIN__)
2871  struct tm *tmptr;
2872  long contz;
2873  struct _timeb tmb;
2874  cob_field field;
2875 #else
2876 
2877  struct tm *tmptr;
2878 #if !defined(__linux__) && !defined(__CYGWIN__) && !defined(COB_STRFTIME) && defined(HAVE_TIMEZONE)
2879  long contz;
2880 #endif
2881  time_t curtime;
2882  cob_field field;
2883 #if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
2884  struct timeval tmv;
2885  char buff2[8];
2886 #endif
2887 #endif
2888  char buff[24];
2889 
2891  make_field_entry (&field);
2892  memset (buff, 0, sizeof(buff));
2893 
2894 #if defined(_WIN32) && !defined(__CYGWIN__)
2895  _ftime (&tmb);
2896  tmptr = localtime (&(tmb.time));
2897  /* Leap seconds ? */
2898  if (tmptr->tm_sec >= 60) {
2899  tmptr->tm_sec = 59;
2900  }
2901  if (tmb.timezone <= 0) {
2902  contz = -tmb.timezone;
2903  snprintf (buff, (size_t)23,
2904  "%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d%2.2d+%2.2ld%2.2ld",
2905  tmptr->tm_year + 1900, tmptr->tm_mon + 1, tmptr->tm_mday,
2906  tmptr->tm_hour, tmptr->tm_min, tmptr->tm_sec,
2907  tmb.millitm / 100, contz / 60, contz % 60);
2908  } else {
2909  contz = tmb.timezone;
2910  snprintf (buff, (size_t)23,
2911  "%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d%2.2d-%2.2ld%2.2ld",
2912  tmptr->tm_year + 1900, tmptr->tm_mon + 1, tmptr->tm_mday,
2913  tmptr->tm_hour, tmptr->tm_min, tmptr->tm_sec,
2914  tmb.millitm / 100, contz / 60, contz % 60);
2915  }
2916 #else /* defined(_WIN32) && !defined(__CYGWIN__) */
2917 
2918 #if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
2919  gettimeofday (&tmv, NULL);
2920  curtime = tmv.tv_sec;
2921 #else
2922  curtime = time (NULL);
2923 #endif
2924  tmptr = localtime (&curtime);
2925  /* Leap seconds ? */
2926  if (tmptr->tm_sec >= 60) {
2927  tmptr->tm_sec = 59;
2928  }
2929 
2930 #if defined(__linux__) || defined(__CYGWIN__) || defined(COB_STRFTIME)
2931  strftime (buff, (size_t)22, "%Y%m%d%H%M%S00%z", tmptr);
2932 #elif defined(HAVE_TIMEZONE)
2933  strftime (buff, (size_t)17, "%Y%m%d%H%M%S00", tmptr);
2934  contz = timezone;
2935  if (tmptr->tm_isdst > 0) {
2936  contz -= 3600;
2937  }
2938  if (contz <= 0) {
2939  contz = -contz;
2940  buff[16] = '+';
2941  } else {
2942  buff[16] = '-';
2943  }
2944  sprintf(&buff[17], "%2.2ld%2.2ld", contz / 3600, (contz % 3600) / 60);
2945 #else
2946  strftime (buff, (size_t)22, "%Y%m%d%H%M%S0000000", tmptr);
2947 #endif
2948 
2949 #if defined(HAVE_SYS_TIME_H) && defined(HAVE_GETTIMEOFDAY)
2950  snprintf(buff2, (size_t)7, "%2.2ld", tmv.tv_usec / 10000);
2951  memcpy (&buff[14], buff2, (size_t)2);
2952 #endif
2953 #endif
2954 
2955  memcpy (curr_field->data, buff, (size_t)21);
2956  if (unlikely(offset > 0)) {
2957  calc_ref_mod (curr_field, offset, length);
2958  }
2959  return curr_field;
2960 }
COB_EXPIMP cob_field* cob_intr_date_of_integer ( cob_field )

References COB_ATTR_INIT, COB_EC_ARGUMENT_FUNCTION, COB_FIELD_INIT, cob_get_int(), cob_set_exception(), COB_TYPE_NUMERIC_DISPLAY, curr_field, cob_field::data, date_of_integer(), make_field_entry(), NULL, and valid_integer_date().

3038 {
3039  int days;
3040  int month;
3041  int year;
3042  cob_field_attr attr;
3043  cob_field field;
3044  char buff[16];
3045 
3046  COB_ATTR_INIT (COB_TYPE_NUMERIC_DISPLAY, 8, 0, 0, NULL);
3047  COB_FIELD_INIT (8, NULL, &attr);
3048  make_field_entry (&field);
3049 
3050  cob_set_exception (0);
3051  /* Base 1601-01-01 */
3052  days = cob_get_int (srcdays);
3053  if (!valid_integer_date (days)) {
3055  memset (curr_field->data, '0', (size_t)8);
3056  return curr_field;
3057  }
3058 
3059  date_of_integer (days, &year, &month, &days);
3060 
3061  snprintf (buff, (size_t)15, "%4.4d%2.2d%2.2d", year, month, days);
3062  memcpy (curr_field->data, buff, (size_t)8);
3063  return curr_field;
3064 }
COB_EXPIMP cob_field* cob_intr_date_to_yyyymmdd ( const int  ,
  ... 
)

References cob_alloc_set_field_int(), cob_alloc_set_field_uint(), COB_EC_ARGUMENT_FUNCTION, cob_get_int(), cob_set_exception(), curr_field, NULL, and valid_year().

4485 {
4486  cob_field *f;
4487  struct tm *timeptr;
4488  va_list args;
4489  time_t t;
4490  int year;
4491  int mmdd;
4492  int interval;
4493  int xqtyear;
4494  int maxyear;
4495 
4496  cob_set_exception (0);
4497  va_start (args, params);
4498  f = va_arg (args, cob_field *);
4499  year = cob_get_int (f);
4500  mmdd = year % 10000;
4501  year /= 10000;
4502  if (params > 1) {
4503  f = va_arg (args, cob_field *);
4504  interval = cob_get_int (f);
4505  } else {
4506  interval = 50;
4507  }
4508  if (params > 2) {
4509  f = va_arg (args, cob_field *);
4510  xqtyear = cob_get_int (f);
4511  } else {
4512  t = time (NULL);
4513  timeptr = localtime (&t);
4514  xqtyear = 1900 + timeptr->tm_year;
4515  }
4516  va_end (args);
4517 
4518  if (year < 0 || year > 999999) {
4521  return curr_field;
4522  }
4523  if (!valid_year (xqtyear)) {
4526  return curr_field;
4527  }
4528  maxyear = xqtyear + interval;
4529  if (maxyear < 1700 || maxyear > 9999) {
4532  return curr_field;
4533  }
4534  if (maxyear % 100 >= year) {
4535  year += 100 * (maxyear / 100);
4536  } else {
4537  year += 100 * ((maxyear / 100) - 1);
4538  }
4539  year *= 10000;
4540  year += mmdd;
4541  cob_alloc_set_field_int (year);
4542  return curr_field;
4543 }
COB_EXPIMP cob_field* cob_intr_day_of_integer ( cob_field )

References COB_ATTR_INIT, COB_EC_ARGUMENT_FUNCTION, COB_FIELD_INIT, cob_get_int(), cob_set_exception(), COB_TYPE_NUMERIC_DISPLAY, curr_field, cob_field::data, day_of_integer(), make_field_entry(), NULL, and valid_integer_date().

3068 {
3069  int days;
3070  int baseyear;
3071  cob_field_attr attr;
3072  cob_field field;
3073  char buff[16];
3074 
3075  COB_ATTR_INIT (COB_TYPE_NUMERIC_DISPLAY, 7, 0, 0, NULL);
3076  COB_FIELD_INIT (7, NULL, &attr);
3077  make_field_entry (&field);
3078 
3079  cob_set_exception (0);
3080  /* Base 1601-01-01 */
3081  days = cob_get_int (srcdays);
3082  if (!valid_integer_date (days)) {
3084  memset (curr_field->data, '0', (size_t)7);
3085  return curr_field;
3086  }
3087 
3088  day_of_integer (days, &baseyear, &days);
3089  snprintf (buff, (size_t)15, "%4.4d%3.3d", baseyear, days);
3090 
3091  memcpy (curr_field->data, buff, (size_t)7);
3092  return curr_field;
3093 }
COB_EXPIMP cob_field* cob_intr_day_to_yyyyddd ( const int  ,
  ... 
)

References cob_alloc_set_field_int(), cob_alloc_set_field_uint(), COB_EC_ARGUMENT_FUNCTION, cob_get_int(), cob_set_exception(), curr_field, NULL, and valid_year().

4547 {
4548  cob_field *f;
4549  struct tm *timeptr;
4550  va_list args;
4551  time_t t;
4552  int year;
4553  int days;
4554  int interval;
4555  int xqtyear;
4556  int maxyear;
4557 
4558  cob_set_exception (0);
4559  va_start (args, params);
4560  f = va_arg (args, cob_field *);
4561  year = cob_get_int (f);
4562  days = year % 1000;
4563  year /= 1000;
4564  if (params > 1) {
4565  f = va_arg (args, cob_field *);
4566  interval = cob_get_int (f);
4567  } else {
4568  interval = 50;
4569  }
4570  if (params > 2) {
4571  f = va_arg (args, cob_field *);
4572  xqtyear = cob_get_int (f);
4573  } else {
4574  t = time (NULL);
4575  timeptr = localtime (&t);
4576  xqtyear = 1900 + timeptr->tm_year;
4577  }
4578  va_end (args);
4579 
4580  if (year < 0 || year > 999999) {
4583  return curr_field;
4584  }
4585  if (!valid_year (xqtyear)) {
4588  return curr_field;
4589  }
4590  maxyear = xqtyear + interval;
4591  if (maxyear < 1700 || maxyear > 9999) {
4594  return curr_field;
4595  }
4596  if (maxyear % 100 >= year) {
4597  year += 100 * (maxyear / 100);
4598  } else {
4599  year += 100 * ((maxyear / 100) - 1);
4600  }
4601  year *= 1000;
4602  year += days;
4603  cob_alloc_set_field_int (year);
4604  return curr_field;
4605 }
COB_EXPIMP cob_field* cob_intr_display_of ( const int  ,
const int  ,
const int  ,
  ... 
)

References cob_fatal_error(), COB_FERROR_FUNCTION, and COB_UNUSED.

5756 {
5757  COB_UNUSED (offset);
5758  COB_UNUSED (length);
5759  COB_UNUSED (params);
5760 
5761  cob_fatal_error (COB_FERROR_FUNCTION);
5762 }
COB_EXPIMP cob_field* cob_intr_e ( void  )

References cob_alloc_field(), cob_decimal_get_field(), cob_decimal_set_mpf(), cob_mpf_exp(), cob_mpft, and curr_field.

3286 {
3287  mpf_set_ui (cob_mpft, 1UL);
3290  cob_alloc_field (&d1);
3291  (void)cob_decimal_get_field (&d1, curr_field, 0);
3292 
3293  return curr_field;
3294 }
COB_EXPIMP cob_field* cob_intr_exception_file ( void  )

References __cob_global::cob_error_file, __cob_global::cob_exception_code, COB_FIELD_INIT, curr_field, cob_field::data, cob_file::file_status, make_field_entry(), NULL, cob_file::select_name, and cob_field::size.

2748 {
2749  size_t flen;
2750  cob_field field;
2751 
2754  (cobglobptr->cob_exception_code & 0x0500) != 0x0500) {
2755  field.size = 2;
2756  make_field_entry (&field);
2757  memcpy (curr_field->data, "00", (size_t)2);
2758  } else {
2759  flen = strlen (cobglobptr->cob_error_file->select_name);
2760  field.size = flen + 2;
2761  make_field_entry (&field);
2762  memcpy (curr_field->data,
2763  cobglobptr->cob_error_file->file_status, (size_t)2);
2764  memcpy (&(curr_field->data[2]),
2766  }
2767  return curr_field;
2768 }
COB_EXPIMP cob_field* cob_intr_exception_file_n ( void  )

References cob_fatal_error(), and COB_FERROR_FUNCTION.

5766 {
5767  cob_fatal_error (COB_FERROR_FUNCTION);
5768 }
COB_EXPIMP cob_field* cob_intr_exception_location ( void  )

References COB_FIELD_INIT, cob_free(), __cob_global::cob_got_exception, cob_malloc(), __cob_global::cob_orig_line, __cob_global::cob_orig_paragraph, __cob_global::cob_orig_program_id, __cob_global::cob_orig_section, COB_SMALL_BUFF, COB_SMALL_MAX, curr_field, cob_field::data, make_field_entry(), NULL, and cob_field::size.

2772 {
2773  char *buff;
2774  cob_field field;
2775 
2778  field.size = 1;
2779  make_field_entry (&field);
2780  *(curr_field->data) = ' ';
2781  return curr_field;
2782  }
2783  buff = cob_malloc ((size_t)COB_SMALL_BUFF);
2785  snprintf (buff, (size_t)COB_SMALL_MAX, "%s; %s OF %s; %u",
2790  } else if (cobglobptr->cob_orig_section) {
2791  snprintf (buff, (size_t)COB_SMALL_MAX, "%s; %s; %u",
2795  } else if (cobglobptr->cob_orig_paragraph) {
2796  snprintf (buff, (size_t)COB_SMALL_MAX, "%s; %s; %u",
2800  } else {
2801  snprintf (buff, (size_t)COB_SMALL_MAX, "%s; ; %u",
2804  }
2805  field.size = strlen (buff);
2806  make_field_entry (&field);
2807  memcpy (curr_field->data, buff, field.size);
2808  cob_free (buff);
2809  return curr_field;
2810 }
COB_EXPIMP cob_field* cob_intr_exception_location_n ( void  )

References cob_fatal_error(), and COB_FERROR_FUNCTION.

5772 {
5773  cob_fatal_error (COB_FERROR_FUNCTION);
5774 }
COB_EXPIMP cob_field* cob_intr_exception_statement ( void  )

References __cob_global::cob_exception_code, COB_FIELD_INIT, __cob_global::cob_orig_statement, curr_field, cob_field::data, make_field_entry(), and NULL.

2834 {
2835  size_t flen;
2836  cob_field field;
2837 
2839  make_field_entry (&field);
2840 
2841  memset (curr_field->data, ' ', (size_t)31);
2843  flen = strlen (cobglobptr->cob_orig_statement);
2844  if (flen > 31) {
2845  memcpy (curr_field->data,
2846  cobglobptr->cob_orig_statement, (size_t)31);
2847  } else {
2848  memcpy (curr_field->data,
2850  }
2851  }
2852  return curr_field;
2853 }
COB_EXPIMP cob_field* cob_intr_exception_status ( void  )

References __cob_global::cob_exception_code, COB_FIELD_INIT, cob_get_exception_name(), curr_field, cob_field::data, make_field_entry(), and NULL.

2814 {
2815  const char *except_name;
2816  cob_field field;
2817 
2819  make_field_entry (&field);
2820 
2821  memset (curr_field->data, ' ', (size_t)31);
2823  except_name = cob_get_exception_name ();
2824  if (except_name == NULL) {
2825  except_name = "EXCEPTION-OBJECT";
2826  }
2827  memcpy (curr_field->data, except_name, strlen (except_name));
2828  }
2829  return curr_field;
2830 }
COB_EXPIMP cob_field* cob_intr_exp ( cob_field )

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_decimal_get_field(), cob_decimal_get_mpf(), cob_decimal_set_field(), cob_decimal_set_mpf(), cob_mpf_exp(), cob_mpft, cob_set_exception(), curr_field, and cob_decimal::value.

3309 {
3310  cob_decimal_set_field (&d1, srcfield);
3311 
3312  cob_set_exception (0);
3313 
3314  if (!mpz_sgn (d1.value)) {
3315  /* Power is zero */
3317  return curr_field;
3318  }
3319 
3323  cob_alloc_field (&d1);
3324  (void)cob_decimal_get_field (&d1, curr_field, 0);
3325 
3326  return curr_field;
3327 }
COB_EXPIMP cob_field* cob_intr_exp10 ( cob_field )

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_decimal_get_field(), cob_decimal_pow(), cob_decimal_set_field(), cob_set_exception(), cob_trim_decimal(), curr_field, cob_decimal::scale, sign, and cob_decimal::value.

3331 {
3332  int sign;
3333 
3334  cob_decimal_set_field (&d1, srcfield);
3335 
3336  cob_set_exception (0);
3337 
3338  sign = mpz_sgn (d1.value);
3339  if (!sign) {
3340  /* Power is zero */
3342  return curr_field;
3343  }
3344 
3345  cob_trim_decimal (&d1);
3346 
3347  if (!d1.scale) {
3348  /* Integer positive/negative powers */
3349  if (sign < 0 && mpz_fits_sint_p (d1.value)) {
3350  mpz_abs (d1.value, d1.value);
3351  d1.scale = mpz_get_si (d1.value);
3352  mpz_set_ui (d1.value, 1UL);
3353  cob_alloc_field (&d1);
3354  (void)cob_decimal_get_field (&d1, curr_field, 0);
3355  return curr_field;
3356  }
3357  if (sign > 0 && mpz_fits_ulong_p (d1.value)) {
3358  mpz_ui_pow_ui (d1.value, 10UL, mpz_get_ui (d1.value));
3359  cob_alloc_field (&d1);
3360  (void)cob_decimal_get_field (&d1, curr_field, 0);
3361  return curr_field;
3362  }
3363  }
3364 
3365  mpz_set_ui (d2.value, 10UL);
3366  d2.scale = 0;
3367  cob_decimal_pow (&d2, &d1);
3368  cob_alloc_field (&d2);
3369  (void)cob_decimal_get_field (&d2, curr_field, 0);
3370 
3371  return curr_field;
3372 }
COB_EXPIMP cob_field* cob_intr_factorial ( cob_field )

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_decimal_get_field(), COB_EC_ARGUMENT_FUNCTION, cob_get_int(), cob_set_exception(), cob_uli_t, curr_field, cob_decimal::scale, and cob_decimal::value.

3265 {
3266  int srcval;
3267 
3268  cob_set_exception (0);
3269  srcval = cob_get_int (srcfield);
3270  d1.scale = 0;
3271  if (srcval < 0) {
3274  return curr_field;
3275  } else {
3276  mpz_fac_ui (d1.value, (cob_uli_t)srcval);
3277  }
3278 
3279  cob_alloc_field (&d1);
3280  (void)cob_decimal_get_field (&d1, curr_field, 0);
3281  return curr_field;
3282 }
COB_EXPIMP cob_field* cob_intr_formatted_current_date ( const int  ,
const int  ,
cob_field  
)

References cob_fatal_error(), COB_FERROR_FUNCTION, and COB_UNUSED.

5779 {
5780  COB_UNUSED (offset);
5781  COB_UNUSED (length);
5782  COB_UNUSED (srcfield);
5783 
5784  cob_fatal_error (COB_FERROR_FUNCTION);
5785 }
COB_EXPIMP cob_field* cob_intr_formatted_date ( const int  ,
const int  ,
cob_field ,
cob_field  
)

References calc_ref_mod(), COB_EC_ARGUMENT_FUNCTION, COB_FIELD_INIT, cob_get_int(), cob_set_exception(), curr_field, cob_field::data, format_date(), make_field_entry(), MAX_DATE_STR_LENGTH, NULL, num_leading_nonspace(), parse_date_format_string(), unlikely, and valid_day_and_format().

5509 {
5510  cob_field field;
5511  size_t field_length =
5512  num_leading_nonspace ((char *) format_field->data);
5513  char format_str[MAX_DATE_STR_LENGTH] = { '\0' };
5514  int days;
5515  struct date_format format;
5516  char buff[MAX_DATE_STR_LENGTH] = { '\0' };
5517 
5518  memcpy (format_str, format_field->data, field_length);
5519 
5520  COB_FIELD_INIT (field_length, NULL, &const_alpha_attr);
5521  make_field_entry (&field);
5522 
5523  cob_set_exception (0);
5524  days = cob_get_int (days_field);
5525 
5526  if (!valid_day_and_format (days, format_str)) {
5527  goto invalid_args;
5528  }
5529 
5530  format = parse_date_format_string (format_str);
5531  format_date (format, days, buff);
5532 
5533  memcpy (curr_field->data, buff, (size_t) field_length);
5534  goto end_of_func;
5535 
5536  invalid_args:
5538  memset (curr_field->data, ' ', strlen (format_str));
5539 
5540  end_of_func:
5541  if (unlikely(offset > 0)) {
5542  calc_ref_mod (curr_field, offset, length);
5543  }
5544  return curr_field;
5545 }
COB_EXPIMP cob_field* cob_intr_formatted_datetime ( const int  ,
const int  ,
const int  ,
  ... 
)

References calc_ref_mod(), COB_EC_ARGUMENT_FUNCTION, COB_FIELD_INIT, cob_get_int(), cob_set_exception(), cob_valid_datetime_format(), curr_field, cob_field::data, format_date(), format_time(), make_field_entry(), MAX_DATE_STR_LENGTH, MAX_DATETIME_STR_LENGTH, MAX_TIME_STR_LENGTH, NULL, num_leading_nonspace(), parse_date_format_string(), parse_time_format_string(), split_around_t(), try_get_valid_offset_time(), unlikely, valid_integer_date(), and valid_time().

5630 {
5631  va_list args;
5632  cob_field *fmt_field;
5633  cob_field *days_field;
5634  cob_field *time_field;
5635  cob_field *offset_time_field;
5636  cob_field field;
5637  size_t field_length;
5638  char fmt_str[MAX_DATETIME_STR_LENGTH] = { '\0' };
5639  char date_fmt_str[MAX_DATE_STR_LENGTH] = { '\0' };
5640  char time_fmt_str[MAX_TIME_STR_LENGTH] = { '\0' };
5641  struct date_format date_fmt;
5642  struct time_format time_fmt;
5643  char formatted_date[MAX_DATE_STR_LENGTH] = { '\0' };
5644  char formatted_time[MAX_TIME_STR_LENGTH] = { '\0' };
5645  int days;
5646  int time;
5647  int offset_time;
5648  int *offset_time_ptr;
5649  char buff[MAX_DATETIME_STR_LENGTH] = { '\0' };
5650 
5651  if (!(params == 3 || params == 4)) {
5653  make_field_entry (&field);
5654  goto invalid_args;
5655  }
5656 
5657  /* Get arguments */
5658  va_start (args, params);
5659 
5660  fmt_field = va_arg (args, cob_field *);
5661  days_field = va_arg (args, cob_field *);
5662  time_field = va_arg (args, cob_field *);
5663  if (params == 4) {
5664  offset_time_field = va_arg (args, cob_field *);
5665  } else {
5666  offset_time_field = NULL;
5667  }
5668 
5669  va_end (args);
5670 
5671  field_length = num_leading_nonspace ((char *) fmt_field->data);
5672  memcpy (fmt_str, fmt_field->data, field_length);
5673 
5674  COB_FIELD_INIT (field_length, NULL, &const_alpha_attr);
5675  make_field_entry (&field);
5676 
5677  cob_set_exception (0);
5678 
5679  /* Validate the formats, dates and times */
5680  if (!cob_valid_datetime_format (fmt_str)) {
5681  goto invalid_args;
5682  }
5683 
5684  days = cob_get_int (days_field);
5685  time = cob_get_int (time_field);
5686 
5687  if (!valid_integer_date (days) || !valid_time (time)) {
5688  goto invalid_args;
5689  }
5690 
5691  split_around_t (fmt_str, date_fmt_str, time_fmt_str);
5692 
5693  time_fmt = parse_time_format_string (time_fmt_str);
5694  if (try_get_valid_offset_time (time_fmt, offset_time_field,
5695  &offset_time, &offset_time_ptr)) {
5696  goto invalid_args;
5697  }
5698 
5699  date_fmt = parse_date_format_string (date_fmt_str);
5700 
5701  /* Format */
5702 
5703  format_date (date_fmt, days, formatted_date);
5704  format_time (time_fmt, time, offset_time_ptr, formatted_time);
5705 
5706  sprintf (buff, "%sT%s", formatted_date, formatted_time);
5707 
5708  memcpy (curr_field->data, buff, (size_t) field_length);
5709  goto end_of_func;
5710 
5711  invalid_args:
5713  if (fmt_str != NULL) {
5714  memset (curr_field->data, ' ', strlen (fmt_str));
5715  }
5716 
5717  end_of_func:
5718  if (unlikely (offset > 0)) {
5719  calc_ref_mod (curr_field, offset, length);
5720  }
5721  return curr_field;
5722 }
COB_EXPIMP cob_field* cob_intr_formatted_time ( const int  ,
const int  ,
const int  ,
  ... 
)

References calc_ref_mod(), COB_EC_ARGUMENT_FUNCTION, COB_FIELD_INIT, cob_get_int(), cob_set_exception(), cob_valid_time_format(), curr_field, cob_field::data, format_time(), make_field_entry(), MAX_TIME_STR_LENGTH, NULL, num_leading_nonspace(), parse_time_format_string(), try_get_valid_offset_time(), unlikely, and valid_time().

5550 {
5551  va_list args;
5552  cob_field *format_field;
5553  cob_field *time_field;
5554  cob_field *offset_time_field;
5555  cob_field field;
5556  size_t field_length;
5557  char buff[MAX_TIME_STR_LENGTH] = { '\0' };
5558  char format_str[MAX_TIME_STR_LENGTH] = { '\0' };
5559  int time;
5560  int offset_time;
5561  int *offset_time_ptr;
5562  struct time_format format;
5563 
5564  if (!(params == 2 || params == 3)) {
5566  make_field_entry (&field);
5567  goto invalid_args;
5568  }
5569 
5570  /* Get args */
5571  va_start (args, params);
5572 
5573  format_field = va_arg (args, cob_field *);
5574  time_field = va_arg (args, cob_field *);
5575  if (params == 3) {
5576  offset_time_field = va_arg (args, cob_field *);
5577  } else {
5578  offset_time_field = NULL;
5579  }
5580 
5581  va_end (args);
5582 
5583  /* Initialise buffers */
5584  field_length = num_leading_nonspace ((char *) format_field->data);
5585  memcpy (format_str, format_field->data, field_length);
5586 
5587  COB_FIELD_INIT (field_length, NULL, &const_alpha_attr);
5588  make_field_entry (&field);
5589 
5590  cob_set_exception (0);
5591 
5592  /* Extract and validate the times and time format */
5593 
5594  time = cob_get_int (time_field);
5595  if (!valid_time (time)) {
5596  goto invalid_args;
5597  }
5598 
5599  if (!cob_valid_time_format (format_str)) {
5600  goto invalid_args;
5601  }
5602  format = parse_time_format_string (format_str);
5603 
5604  if (try_get_valid_offset_time (format, offset_time_field,
5605  &offset_time, &offset_time_ptr)) {
5606  goto invalid_args;
5607  }
5608 
5609  format_time (format, time, offset_time_ptr, buff);
5610 
5611  memcpy (curr_field->data, buff, (size_t) field_length);
5612  goto end_of_func;
5613 
5614 invalid_args:
5616  if (format_str != NULL) {
5617  memset (curr_field->data, ' ', strlen (format_str));
5618  }
5619 
5620  end_of_func:
5621  if (unlikely(offset > 0)) {
5622  calc_ref_mod (curr_field, offset, length);
5623  }
5624  return curr_field;
5625 }
COB_EXPIMP cob_field* cob_intr_fraction_part ( cob_field )

References cob_alloc_field(), cob_decimal_get_field(), cob_decimal_set_field(), cob_mexp, cob_uli_t, curr_field, cob_decimal::scale, and cob_decimal::value.

2277 {
2278  cob_decimal_set_field (&d1, srcfield);
2279  /* Check scale */
2280  if (d1.scale > 0) {
2281  mpz_ui_pow_ui (cob_mexp, 10UL, (cob_uli_t)d1.scale);
2282  mpz_tdiv_r (d1.value, d1.value, cob_mexp);
2283  } else {
2284  /* No decimals */
2285  mpz_set_ui (d1.value, 0UL);
2286  d1.scale = 0;
2287  }
2288 
2289  cob_alloc_field (&d1);
2290  (void)cob_decimal_get_field (&d1, curr_field, 0);
2291  return curr_field;
2292 }
COB_EXPIMP cob_field* cob_intr_highest_algebraic ( cob_field )

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_decimal_get_field(), COB_EC_ARGUMENT_FUNCTION, COB_FIELD_BINARY_TRUNC, COB_FIELD_DIGITS, COB_FIELD_HAVE_SIGN, COB_FIELD_INIT, COB_FIELD_REAL_BINARY, COB_FIELD_SCALE, COB_FIELD_SIZE, COB_FIELD_TYPE, cob_set_exception(), COB_TYPE_ALPHANUMERIC, COB_TYPE_ALPHANUMERIC_EDITED, COB_TYPE_NATIONAL, COB_TYPE_NATIONAL_EDITED, COB_TYPE_NUMERIC_BINARY, COB_TYPE_NUMERIC_DISPLAY, COB_TYPE_NUMERIC_DOUBLE, COB_TYPE_NUMERIC_EDITED, COB_TYPE_NUMERIC_FLOAT, COB_TYPE_NUMERIC_PACKED, cob_uli_t, curr_field, cob_field::data, make_field_entry(), NULL, cob_decimal::scale, and cob_decimal::value.

5339 {
5340  cob_uli_t expo;
5341  size_t size;
5342  cob_field field;
5343 
5344  switch (COB_FIELD_TYPE (srcfield)) {
5345  case COB_TYPE_ALPHANUMERIC:
5346  case COB_TYPE_NATIONAL:
5347  size = COB_FIELD_SIZE (srcfield);
5349  make_field_entry (&field);
5350  memset (curr_field->data, 255, size);
5351  break;
5352 
5355  size = COB_FIELD_DIGITS (srcfield);
5357  make_field_entry (&field);
5358  memset (curr_field->data, 255, size);
5359  break;
5360 
5362  if (COB_FIELD_REAL_BINARY (srcfield) ||
5363  !COB_FIELD_BINARY_TRUNC (srcfield)) {
5364  if (!COB_FIELD_HAVE_SIGN (srcfield)) {
5365  expo = COB_FIELD_SIZE (srcfield) * 8U;
5366  } else {
5367  expo = (COB_FIELD_SIZE (srcfield) * 8U) - 1U;
5368  }
5369  mpz_ui_pow_ui (d1.value, 2UL, expo);
5370  mpz_sub_ui (d1.value, d1.value, 1UL);
5371  d1.scale = COB_FIELD_SCALE (srcfield);
5372  cob_alloc_field (&d1);
5373  (void)cob_decimal_get_field (&d1, curr_field, 0);
5374  break;
5375  }
5376  expo = (cob_uli_t)COB_FIELD_DIGITS (srcfield);
5377  mpz_ui_pow_ui (d1.value, 10UL, expo);
5378  mpz_sub_ui (d1.value, d1.value, 1UL);
5379  d1.scale = COB_FIELD_SCALE (srcfield);
5380  cob_alloc_field (&d1);
5381  (void)cob_decimal_get_field (&d1, curr_field, 0);
5382  break;
5383 
5388  break;
5389 
5393  expo = (cob_uli_t)COB_FIELD_DIGITS (srcfield);
5394  mpz_ui_pow_ui (d1.value, 10UL, expo);
5395  mpz_sub_ui (d1.value, d1.value, 1UL);
5396  d1.scale = COB_FIELD_SCALE (srcfield);
5397  cob_alloc_field (&d1);
5398  (void)cob_decimal_get_field (&d1, curr_field, 0);
5399  break;
5400  default:
5403  break;
5404  }
5405  return curr_field;
5406 }
COB_EXPIMP cob_field* cob_intr_integer ( cob_field )

References cob_alloc_field(), cob_decimal_get_field(), cob_decimal_set_field(), cob_mexp, cob_mpzt, cob_uli_t, curr_field, cob_decimal::scale, sign, and cob_decimal::value.

2232 {
2233  int sign;
2234 
2235  cob_decimal_set_field (&d1, srcfield);
2236  /* Check scale */
2237  if (d1.scale < 0) {
2238  mpz_ui_pow_ui (cob_mexp, 10UL, (cob_uli_t)-d1.scale);
2239  mpz_mul (d1.value, d1.value, cob_mexp);
2240  } else if (d1.scale > 0) {
2241  sign = mpz_sgn (d1.value);
2242  mpz_ui_pow_ui (cob_mexp, 10UL, (cob_uli_t)d1.scale);
2243  mpz_tdiv_qr (d1.value, cob_mpzt, d1.value, cob_mexp);
2244  /* Check negative and has decimal places */
2245  if (sign < 0 && mpz_sgn (cob_mpzt)) {
2246  mpz_sub_ui (d1.value, d1.value, 1UL);
2247  }
2248  }
2249  d1.scale = 0;
2250 
2251  cob_alloc_field (&d1);
2252  (void)cob_decimal_get_field (&d1, curr_field, 0);
2253  return curr_field;
2254 }
COB_EXPIMP cob_field* cob_intr_integer_of_boolean ( cob_field )

References cob_fatal_error(), COB_FERROR_FUNCTION, and COB_UNUSED.

5789 {
5790  COB_UNUSED (srcfield);
5791 
5792  cob_fatal_error (COB_FERROR_FUNCTION);
5793 }
COB_EXPIMP cob_field* cob_intr_integer_of_date ( cob_field )

References cob_alloc_set_field_int(), cob_alloc_set_field_uint(), COB_EC_ARGUMENT_FUNCTION, cob_get_int(), cob_set_exception(), curr_field, leap_days, leap_month_days, leap_year(), normal_days, normal_month_days, and valid_year().

3097 {
3098  int indate;
3099  int days;
3100  int totaldays;
3101  int month;
3102  int year;
3103  int baseyear;
3104 
3105  cob_set_exception (0);
3106  /* Base 1601-01-01 */
3107  indate = cob_get_int (srcfield);
3108  year = indate / 10000;
3109  if (!valid_year (year)) {
3112  return curr_field;
3113  }
3114  indate %= 10000;
3115  month = indate / 100;
3116  if (month < 1 || month > 12) {
3119  return curr_field;
3120  }
3121  days = indate % 100;
3122  if (days < 1 || days > 31) {
3125  return curr_field;
3126  }
3127  if (leap_year (year)) {
3128  if (days > leap_month_days[month]) {
3131  return curr_field;
3132  }
3133  } else {
3134  if (days > normal_month_days[month]) {
3137  return curr_field;
3138  }
3139  }
3140  totaldays = 0;
3141  baseyear = 1601;
3142  while (baseyear != year) {
3143  if (leap_year (baseyear)) {
3144  totaldays += 366;
3145  } else {
3146  totaldays += 365;
3147  }
3148  ++baseyear;
3149  }
3150  if (leap_year (baseyear)) {
3151  totaldays += leap_days[month - 1];
3152  } else {
3153  totaldays += normal_days[month - 1];
3154  }
3155  totaldays += days;
3156  cob_alloc_set_field_int (totaldays);
3157  return curr_field;
3158 }
COB_EXPIMP cob_field* cob_intr_integer_of_day ( cob_field )

References cob_alloc_set_field_uint(), COB_EC_ARGUMENT_FUNCTION, cob_get_int(), cob_set_exception(), cob_u32_t, curr_field, leap_year(), and valid_year().

3162 {
3163  int indate;
3164  int days;
3165  cob_u32_t totaldays;
3166  int year;
3167  int baseyear;
3168 
3169  cob_set_exception (0);
3170  /* Base 1601-01-01 */
3171  indate = cob_get_int (srcfield);
3172  year = indate / 1000;
3173  if (!valid_year (year)) {
3176  return curr_field;
3177  }
3178  days = indate % 1000;
3179  if (days < 1 || days > 365 + leap_year (year)) {
3182  return curr_field;
3183  }
3184  totaldays = 0;
3185  baseyear = 1601;
3186  while (baseyear != year) {
3187  if (leap_year (baseyear)) {
3188  totaldays += 366;
3189  } else {
3190  totaldays += 365;
3191  }
3192  ++baseyear;
3193  }
3194  totaldays += days;
3195  cob_alloc_set_field_uint (totaldays);
3196  return curr_field;
3197 }
COB_EXPIMP cob_field* cob_intr_integer_of_formatted_date ( cob_field ,
cob_field  
)

References cob_fatal_error(), COB_FERROR_FUNCTION, and COB_UNUSED.

5729 {
5730  COB_UNUSED (format_field);
5731  COB_UNUSED (date_field);
5732 
5733  cob_fatal_error (COB_FERROR_FUNCTION);
5734 }
COB_EXPIMP cob_field* cob_intr_integer_part ( cob_field )

References cob_alloc_field(), cob_decimal_get_field(), cob_decimal_set_field(), cob_mexp, cob_uli_t, curr_field, cob_decimal::scale, and cob_decimal::value.

2258 {
2259  cob_decimal_set_field (&d1, srcfield);
2260  /* Check scale */
2261  if (d1.scale < 0) {
2262  mpz_ui_pow_ui (cob_mexp, 10UL, (cob_uli_t)-d1.scale);
2263  mpz_mul (d1.value, d1.value, cob_mexp);
2264  } else if (d1.scale > 0) {
2265  mpz_ui_pow_ui (cob_mexp, 10UL, (cob_uli_t)d1.scale);
2266  mpz_tdiv_q (d1.value, d1.value, cob_mexp);
2267  }
2268  d1.scale = 0;
2269 
2270  cob_alloc_field (&d1);
2271  (void)cob_decimal_get_field (&d1, curr_field, 0);
2272  return curr_field;
2273 }
COB_EXPIMP cob_field* cob_intr_lcl_time_from_secs ( const int  ,
const int  ,
cob_field ,
cob_field  
)

References calc_ref_mod(), COB_EC_ARGUMENT_FUNCTION, COB_FIELD_INIT, COB_FIELD_IS_NUMERIC, cob_field_to_string(), cob_get_int(), __cob_global::cob_locale, cob_set_exception(), COB_SMALL_BUFF, COB_SMALL_MAX, curr_field, cob_field::data, make_field_entry(), NULL, p, cob_field::size, unlikely, and valid_time().

4961 {
4962  cob_field field;
4963 #if defined(_WIN32) || defined(__CYGWIN__) || defined(HAVE_LANGINFO_CODESET)
4964  size_t len;
4965  int indate;
4966  int hours;
4967  int minutes;
4968  int seconds;
4969 #ifdef HAVE_LANGINFO_CODESET
4970  char *deflocale = NULL;
4971  struct tm tstruct;
4972  char buff2[128];
4973 #else
4974  unsigned char *p;
4975  LCID localeid = LOCALE_USER_DEFAULT;
4976  SYSTEMTIME syst;
4977 #endif
4978  char buff[128];
4979  char locale_buff[COB_SMALL_BUFF];
4980 #endif
4981 
4983  cob_set_exception (0);
4984 
4985 #if defined(_WIN32) || defined(__CYGWIN__) || defined(HAVE_LANGINFO_CODESET)
4986  if (COB_FIELD_IS_NUMERIC (srcfield)) {
4987  indate = cob_get_int (srcfield);
4988  } else {
4989  goto derror;
4990  }
4991  if (!valid_time (indate)) {
4992  goto derror;
4993  }
4994  hours = indate / 3600;
4995  indate %= 3600;
4996  minutes = indate / 60;
4997  seconds = indate % 60;
4998 
4999 #ifdef HAVE_LANGINFO_CODESET
5000  memset ((void *)&tstruct, 0, sizeof(struct tm));
5001  tstruct.tm_hour = hours;
5002  tstruct.tm_min = minutes;
5003  tstruct.tm_sec = seconds;
5004  if (locale_field) {
5005  if (locale_field->size >= COB_SMALL_BUFF) {
5006  goto derror;
5007  }
5008  cob_field_to_string (locale_field, locale_buff,
5009  (size_t)COB_SMALL_MAX);
5010  deflocale = locale_buff;
5011  (void) setlocale (LC_TIME, deflocale);
5012  }
5013  memset (buff2, 0, sizeof(buff2));
5014  snprintf(buff2, sizeof(buff2) - 1, "%s", nl_langinfo(T_FMT));
5015  if (deflocale) {
5016  (void) setlocale (LC_ALL, cobglobptr->cob_locale);
5017  }
5018  strftime (buff, sizeof(buff), buff2, &tstruct);
5019 #else
5020  memset ((void *)&syst, 0, sizeof(syst));
5021  syst.wHour = hours;
5022  syst.wMinute = minutes;
5023  syst.wSecond = seconds;
5024  if (locale_field) {
5025  if (locale_field->size >= COB_SMALL_BUFF) {
5026  goto derror;
5027  }
5028  cob_field_to_string (locale_field, locale_buff,
5029  COB_SMALL_MAX);
5030  for (p = (unsigned char *)locale_buff; *p; ++p) {
5031  if (isalnum(*p) || *p == '_') {
5032  continue;
5033  }
5034  break;
5035  }
5036  *p = 0;
5037  for (len = 0; len < WINLOCSIZE; ++len) {
5038  if (!strcmp(locale_buff, wintable[len].winlocalename)) {
5039  localeid = wintable[len].winlocaleid;
5040  break;
5041  }
5042  }
5043  if (len == WINLOCSIZE) {
5044  goto derror;
5045  }
5046  }
5047  if (!GetTimeFormat (localeid, LOCALE_NOUSEROVERRIDE, &syst, NULL, buff, sizeof(buff))) {
5048 
5049  goto derror;
5050  }
5051 #endif
5052  len = strlen (buff);
5053  field.size = len;
5054  make_field_entry (&field);
5055  memcpy (curr_field->data, buff, len);
5056  if (unlikely(offset > 0)) {
5057  calc_ref_mod (curr_field, offset, length);
5058  }
5059  return curr_field;
5060 derror:
5061 #endif
5062  field.size = 10;
5063  make_field_entry (&field);
5064  memset (curr_field->data, ' ', (size_t)10);
5066  return curr_field;
5067 }
COB_EXPIMP cob_field* cob_intr_length ( cob_field )

References cob_alloc_set_field_uint(), COB_FIELD_IS_NATIONAL, COB_NATIONAL_SIZE, cob_u32_t, curr_field, and cob_field::size.

2214 {
2215  if (COB_FIELD_IS_NATIONAL (srcfield)) {
2216  cob_alloc_set_field_uint ((cob_u32_t)srcfield->size / COB_NATIONAL_SIZE);
2217  } else {
2218  cob_alloc_set_field_uint ((cob_u32_t)srcfield->size);
2219  }
2220  return curr_field;
2221 }
COB_EXPIMP cob_field* cob_intr_locale_compare ( const int  ,
  ... 
)

References COB_EC_ARGUMENT_FUNCTION, COB_FIELD_INIT, cob_field_to_string(), cob_free(), __cob_global::cob_locale, cob_malloc(), cob_set_exception(), curr_field, cob_field::data, make_field_entry(), NULL, p, and cob_field::size.

5410 {
5411  cob_field *f1;
5412  cob_field *f2;
5413  cob_field *locale_field;
5414 #ifdef HAVE_STRCOLL
5415  unsigned char *p;
5416  unsigned char *p1;
5417  unsigned char *p2;
5418  char *deflocale;
5419  size_t size;
5420  size_t size2;
5421  int ret;
5422 #endif
5423  cob_field field;
5424  va_list args;
5425 
5426  cob_set_exception (0);
5427  va_start (args, params);
5428  f1 = va_arg (args, cob_field *);
5429  f2 = va_arg (args, cob_field *);
5430  if (params > 2) {
5431  locale_field = va_arg (args, cob_field *);
5432  } else {
5433  locale_field = NULL;
5434  }
5435  va_end (args);
5436 
5438  make_field_entry (&field);
5439 
5440 #ifdef HAVE_STRCOLL
5441  deflocale = NULL;
5442 
5443  size = f1->size;
5444  size2 = size;
5445  for (p = f1->data + size - 1U; p != f1->data; --p) {
5446  if (*p != ' ') {
5447  break;
5448  }
5449  size2--;
5450  }
5451  p1 = cob_malloc (size2 + 1U);
5452  memcpy (p1, f1->data, size2);
5453 
5454  size = f2->size;
5455  size2 = size;
5456  for (p = f2->data + size - 1U; p != f2->data; --p) {
5457  if (*p != ' ') {
5458  break;
5459  }
5460  size2--;
5461  }
5462  p2 = cob_malloc (size2 + 1U);
5463  memcpy (p2, f2->data, size2);
5464 
5465  if (locale_field) {
5466  if (!locale_field->size) {
5467  goto derror;
5468  }
5469 #ifdef HAVE_SETLOCALE
5470  deflocale = cob_malloc (locale_field->size + 1U);
5471  cob_field_to_string (locale_field, deflocale,
5472  (size_t)(locale_field->size + 1U));
5473  (void) setlocale (LC_COLLATE, deflocale);
5474 #else
5475  goto derror;
5476 #endif
5477  }
5478 
5479  ret = strcoll ((char *)p1, (char *)p2);
5480  if (ret < 0) {
5481  curr_field->data[0] = '<';
5482  } else if (ret > 0) {
5483  curr_field->data[0] = '>';
5484  } else {
5485  curr_field->data[0] = '=';
5486  }
5487  cob_free (p1);
5488  cob_free (p2);
5489 
5490 #ifdef HAVE_SETLOCALE
5491  if (deflocale) {
5492  (void) setlocale (LC_ALL, cobglobptr->cob_locale);
5493  cob_free (deflocale);
5494  }
5495 #endif
5496 
5497  return curr_field;
5498 derror:
5499 #endif
5500  curr_field->data[0] = ' ';
5502 
5503  return curr_field;
5504 }
COB_EXPIMP cob_field* cob_intr_locale_date ( const int  ,
const int  ,
cob_field ,
cob_field  
)

References calc_ref_mod(), COB_EC_ARGUMENT_FUNCTION, COB_FIELD_INIT, COB_FIELD_IS_NUMERIC, cob_field_to_string(), cob_get_int(), __cob_global::cob_locale, cob_set_exception(), COB_SMALL_BUFF, COB_SMALL_MAX, curr_field, cob_field::data, leap_month_days, leap_year(), make_field_entry(), normal_month_days, NULL, p, cob_field::size, unlikely, and valid_year().

4692 {
4693  cob_field field;
4694 #if defined(_WIN32) || defined(__CYGWIN__) || defined(HAVE_LANGINFO_CODESET)
4695  size_t len;
4696  int indate;
4697  int days;
4698  int month;
4699  int year;
4700 #ifdef HAVE_LANGINFO_CODESET
4701  unsigned char *p;
4702  char *deflocale = NULL;
4703  struct tm tstruct;
4704  char buff2[128];
4705 #else
4706  unsigned char *p;
4707  LCID localeid = LOCALE_USER_DEFAULT;
4708  SYSTEMTIME syst;
4709 #endif
4710  char buff[128];
4711  char locale_buff[COB_SMALL_BUFF];
4712 #endif
4713 
4715  cob_set_exception (0);
4716 
4717 #if defined(_WIN32) || defined(__CYGWIN__) || defined(HAVE_LANGINFO_CODESET)
4718  if (COB_FIELD_IS_NUMERIC (srcfield)) {
4719  indate = cob_get_int (srcfield);
4720  } else {
4721  if (srcfield->size < 8) {
4722  goto derror;
4723  }
4724  p = srcfield->data;
4725  indate = 0;
4726  for (len = 0; len < 8; ++len, ++p) {
4727  if (isdigit (*p)) {
4728  indate *= 10;
4729  indate += (*p - '0');
4730  } else {
4731  goto derror;
4732  }
4733  }
4734  }
4735  year = indate / 10000;
4736  if (!valid_year (year)) {
4737  goto derror;
4738  }
4739  indate %= 10000;
4740  month = indate / 100;
4741  if (month < 1 || month > 12) {
4742  goto derror;
4743  }
4744  days = indate % 100;
4745  if (days < 1 || days > 31) {
4746  goto derror;
4747  }
4748  if (leap_year (year)) {
4749  if (days > leap_month_days[month]) {
4750  goto derror;
4751  }
4752  } else {
4753  if (days > normal_month_days[month]) {
4754  goto derror;
4755  }
4756  }
4757 #ifdef HAVE_LANGINFO_CODESET
4758  month--;
4759 
4760  memset ((void *)&tstruct, 0, sizeof(struct tm));
4761  tstruct.tm_year = year - 1900;
4762  tstruct.tm_mon = month;
4763  tstruct.tm_mday = days;
4764  if (locale_field) {
4765  if (locale_field->size >= COB_SMALL_BUFF) {
4766  goto derror;
4767  }
4768  cob_field_to_string (locale_field, locale_buff,
4769  (size_t)COB_SMALL_MAX);
4770  deflocale = locale_buff;
4771  (void) setlocale (LC_TIME, deflocale);
4772  }
4773  memset (buff2, 0, sizeof(buff2));
4774  snprintf(buff2, sizeof(buff2) - 1, "%s", nl_langinfo(D_FMT));
4775  if (deflocale) {
4776  (void) setlocale (LC_ALL, cobglobptr->cob_locale);
4777  }
4778  strftime (buff, sizeof(buff), buff2, &tstruct);
4779 #else
4780  memset ((void *)&syst, 0, sizeof(syst));
4781  syst.wYear = year;
4782  syst.wMonth = month;
4783  syst.wDay = days;
4784  if (locale_field) {
4785  if (locale_field->size >= COB_SMALL_BUFF) {
4786  goto derror;
4787  }
4788  cob_field_to_string (locale_field, locale_buff,
4789  COB_SMALL_MAX);
4790  for (p = (unsigned char *)locale_buff; *p; ++p) {
4791  if (isalnum(*p) || *p == '_') {
4792  continue;
4793  }
4794  break;
4795  }
4796  *p = 0;
4797  for (len = 0; len < WINLOCSIZE; ++len) {
4798  if (!strcmp(locale_buff, wintable[len].winlocalename)) {
4799  localeid = wintable[len].winlocaleid;
4800  break;
4801  }
4802  }
4803  if (len == WINLOCSIZE) {
4804  goto derror;
4805  }
4806  }
4807  if (!GetDateFormat (localeid, DATE_SHORTDATE, &syst, NULL, buff, sizeof(buff))) {
4808  goto derror;
4809  }
4810 #endif
4811  len = strlen (buff);
4812  field.size = len;
4813  make_field_entry (&field);
4814  memcpy (curr_field->data, buff, len);
4815  if (unlikely(offset > 0)) {
4816  calc_ref_mod (curr_field, offset, length);
4817  }
4818  return curr_field;
4819 derror:
4820 #endif
4821  field.size = 10;
4822  make_field_entry (&field);
4823  memset (curr_field->data, ' ', (size_t)10);
4825  return curr_field;
4826 }
COB_EXPIMP cob_field* cob_intr_locale_time ( const int  ,
const int  ,
cob_field ,
cob_field  
)

References calc_ref_mod(), COB_EC_ARGUMENT_FUNCTION, COB_FIELD_INIT, COB_FIELD_IS_NUMERIC, cob_field_to_string(), cob_get_int(), __cob_global::cob_locale, cob_set_exception(), COB_SMALL_BUFF, COB_SMALL_MAX, curr_field, cob_field::data, make_field_entry(), NULL, p, cob_field::size, and unlikely.

4831 {
4832  cob_field field;
4833 #if defined(_WIN32) || defined(__CYGWIN__) || defined(HAVE_LANGINFO_CODESET)
4834  size_t len;
4835  int indate;
4836  int hours;
4837  int minutes;
4838  int seconds;
4839 #ifdef HAVE_LANGINFO_CODESET
4840  unsigned char *p;
4841  char *deflocale = NULL;
4842  struct tm tstruct;
4843  char buff2[128];
4844 #else
4845  unsigned char *p;
4846  LCID localeid = LOCALE_USER_DEFAULT;
4847  SYSTEMTIME syst;
4848 #endif
4849  char buff[128];
4850  char locale_buff[COB_SMALL_BUFF];
4851 #endif
4852 
4854  cob_set_exception (0);
4855 
4856 #if defined(_WIN32) || defined(__CYGWIN__) || defined(HAVE_LANGINFO_CODESET)
4857  if (COB_FIELD_IS_NUMERIC (srcfield)) {
4858  indate = cob_get_int (srcfield);
4859  } else {
4860  if (srcfield->size < 6) {
4861  goto derror;
4862  }
4863  p = srcfield->data;
4864  indate = 0;
4865  for (len = 0; len < 6; ++len, ++p) {
4866  if (isdigit (*p)) {
4867  indate *= 10;
4868  indate += (*p - '0');
4869  } else {
4870  goto derror;
4871  }
4872  }
4873  }
4874  hours = indate / 10000;
4875  if (hours < 0 || hours > 24) {
4876  goto derror;
4877  }
4878  indate %= 10000;
4879  minutes = indate / 100;
4880  if (minutes < 0 || minutes > 59) {
4881  goto derror;
4882  }
4883  seconds = indate % 100;
4884  if (seconds < 0 || seconds > 59) {
4885  goto derror;
4886  }
4887 
4888 #ifdef HAVE_LANGINFO_CODESET
4889  memset ((void *)&tstruct, 0, sizeof(struct tm));
4890  tstruct.tm_hour = hours;
4891  tstruct.tm_min = minutes;
4892  tstruct.tm_sec = seconds;
4893  if (locale_field) {
4894  if (locale_field->size >= COB_SMALL_BUFF) {
4895  goto derror;
4896  }
4897  cob_field_to_string (locale_field, locale_buff,
4898  (size_t)COB_SMALL_MAX);
4899  deflocale = locale_buff;
4900  (void) setlocale (LC_TIME, deflocale);
4901  }
4902  memset (buff2, 0, sizeof(buff2));
4903  snprintf(buff2, sizeof(buff2) - 1, "%s", nl_langinfo(T_FMT));
4904  if (deflocale) {
4905  (void) setlocale (LC_ALL, cobglobptr->cob_locale);
4906  }
4907  strftime (buff, sizeof(buff), buff2, &tstruct);
4908 #else
4909  memset ((void *)&syst, 0, sizeof(syst));
4910  syst.wHour = hours;
4911  syst.wMinute = minutes;
4912  syst.wSecond = seconds;
4913  if (locale_field) {
4914  if (locale_field->size >= COB_SMALL_BUFF) {
4915  goto derror;
4916  }
4917  cob_field_to_string (locale_field, locale_buff,
4918  COB_SMALL_MAX);
4919  for (p = (unsigned char *)locale_buff; *p; ++p) {
4920  if (isalnum((int)*p) || *p == '_') {
4921  continue;
4922  }
4923  break;
4924  }
4925  *p = 0;
4926  for (len = 0; len < WINLOCSIZE; ++len) {
4927  if (!strcmp(locale_buff, wintable[len].winlocalename)) {
4928  localeid = wintable[len].winlocaleid;
4929  break;
4930  }
4931  }
4932  if (len == WINLOCSIZE) {
4933  goto derror;
4934  }
4935  }
4936  if (!GetTimeFormat (localeid, LOCALE_NOUSEROVERRIDE, &syst, NULL, buff, sizeof(buff))) {
4937 
4938  goto derror;
4939  }
4940 #endif
4941  len = strlen (buff);
4942  field.size = len;
4943  make_field_entry (&field);
4944  memcpy (curr_field->data, buff, len);
4945  if (unlikely(offset > 0)) {
4946  calc_ref_mod (curr_field, offset, length);
4947  }
4948  return curr_field;
4949 derror:
4950 #endif
4951  field.size = 10;
4952  make_field_entry (&field);
4953  memset (curr_field->data, ' ', (size_t)10);
4955  return curr_field;
4956 }
COB_EXPIMP cob_field* cob_intr_log ( cob_field )

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_decimal_get_field(), cob_decimal_get_mpf(), cob_decimal_set_field(), cob_decimal_set_mpf(), COB_EC_ARGUMENT_FUNCTION, cob_mpf_log(), cob_mpft, cob_set_exception(), cob_trim_decimal(), curr_field, cob_decimal::scale, and cob_decimal::value.

3376 {
3377  cob_decimal_set_field (&d1, srcfield);
3378 
3379  cob_set_exception (0);
3380  if (mpz_sgn (d1.value) <= 0) {
3383  return curr_field;
3384  }
3385 
3386  if (d1.scale) {
3387  cob_trim_decimal (&d1);
3388  }
3389 
3390  if (!d1.scale && !mpz_cmp_ui (d1.value, 1UL)) {
3391  /* Log (1) = 0 */
3393  return curr_field;
3394  }
3395 
3399  cob_alloc_field (&d1);
3400  (void)cob_decimal_get_field (&d1, curr_field, 0);
3401 
3402  return curr_field;
3403 }
COB_EXPIMP cob_field* cob_intr_log10 ( cob_field )

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_decimal_get_field(), cob_decimal_get_mpf(), cob_decimal_set_field(), cob_decimal_set_mpf(), COB_EC_ARGUMENT_FUNCTION, cob_mpf_log10(), cob_mpft, cob_set_exception(), cob_trim_decimal(), curr_field, cob_decimal::scale, and cob_decimal::value.

3407 {
3408  cob_decimal_set_field (&d1, srcfield);
3409 
3410  cob_set_exception (0);
3411  if (mpz_sgn (d1.value) <= 0) {
3414  return curr_field;
3415  }
3416 
3417  if (d1.scale) {
3418  cob_trim_decimal (&d1);
3419  }
3420 
3421  if (!d1.scale && !mpz_cmp_ui (d1.value, 1UL)) {
3422  /* Log10 (1) = 0 */
3424  return curr_field;
3425  }
3426 
3430  cob_alloc_field (&d1);
3431  (void)cob_decimal_get_field (&d1, curr_field, 0);
3432 
3433  return curr_field;
3434 }
COB_EXPIMP cob_field* cob_intr_lower_case ( const int  ,
const int  ,
cob_field  
)

References calc_ref_mod(), cob_u8_t, curr_field, cob_field::data, make_field_entry(), cob_field::size, and unlikely.

2321 {
2322  size_t i, size;
2323 
2324  make_field_entry (srcfield);
2325 
2326  size = srcfield->size;
2327  for (i = 0; i < size; ++i) {
2328  curr_field->data[i] = (cob_u8_t)tolower (srcfield->data[i]);
2329  }
2330  if (unlikely(offset > 0)) {
2331  calc_ref_mod (curr_field, offset, length);
2332  }
2333  return curr_field;
2334 }
COB_EXPIMP cob_field* cob_intr_lowest_algebraic ( cob_field )

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_decimal_get_field(), COB_EC_ARGUMENT_FUNCTION, COB_FIELD_BINARY_TRUNC, COB_FIELD_DIGITS, COB_FIELD_HAVE_SIGN, COB_FIELD_INIT, COB_FIELD_REAL_BINARY, COB_FIELD_SCALE, COB_FIELD_SIZE, COB_FIELD_TYPE, cob_set_exception(), COB_TYPE_ALPHANUMERIC, COB_TYPE_ALPHANUMERIC_EDITED, COB_TYPE_NATIONAL, COB_TYPE_NATIONAL_EDITED, COB_TYPE_NUMERIC_BINARY, COB_TYPE_NUMERIC_DISPLAY, COB_TYPE_NUMERIC_DOUBLE, COB_TYPE_NUMERIC_EDITED, COB_TYPE_NUMERIC_FLOAT, COB_TYPE_NUMERIC_PACKED, cob_uli_t, curr_field, make_field_entry(), NULL, cob_decimal::scale, and cob_decimal::value.

5267 {
5268  cob_uli_t expo;
5269  cob_field field;
5270 
5271  switch (COB_FIELD_TYPE (srcfield)) {
5272  case COB_TYPE_ALPHANUMERIC:
5273  case COB_TYPE_NATIONAL:
5274  COB_FIELD_INIT (COB_FIELD_SIZE (srcfield), NULL, &const_alpha_attr);
5275  make_field_entry (&field);
5276  break;
5277 
5280  COB_FIELD_INIT (COB_FIELD_DIGITS (srcfield), NULL, &const_alpha_attr);
5281  make_field_entry (&field);
5282  break;
5283 
5285  if (!COB_FIELD_HAVE_SIGN (srcfield)) {
5287  break;
5288  }
5289  if (COB_FIELD_REAL_BINARY (srcfield) ||
5290  !COB_FIELD_BINARY_TRUNC (srcfield)) {
5291  expo = (cob_uli_t)((COB_FIELD_SIZE (srcfield) * 8U) - 1U);
5292  mpz_ui_pow_ui (d1.value, 2UL, expo);
5293  mpz_neg (d1.value, d1.value);
5294  d1.scale = COB_FIELD_SCALE (srcfield);
5295  cob_alloc_field (&d1);
5296  (void)cob_decimal_get_field (&d1, curr_field, 0);
5297  break;
5298  }
5299  expo = (cob_uli_t)COB_FIELD_DIGITS (srcfield);
5300  mpz_ui_pow_ui (d1.value, 10UL, expo);
5301  mpz_sub_ui (d1.value, d1.value, 1UL);
5302  mpz_neg (d1.value, d1.value);
5303  d1.scale = COB_FIELD_SCALE (srcfield);
5304  cob_alloc_field (&d1);
5305  (void)cob_decimal_get_field (&d1, curr_field, 0);
5306  break;
5307 
5312  break;
5313 
5317  if (!COB_FIELD_HAVE_SIGN (srcfield)) {
5319  break;
5320  }
5321  expo = (cob_uli_t)COB_FIELD_DIGITS (srcfield);
5322  mpz_ui_pow_ui (d1.value, 10UL, expo);
5323  mpz_sub_ui (d1.value, d1.value, 1UL);
5324  mpz_neg (d1.value, d1.value);
5325  d1.scale = COB_FIELD_SCALE (srcfield);
5326  cob_alloc_field (&d1);
5327  (void)cob_decimal_get_field (&d1, curr_field, 0);
5328  break;
5329  default:
5332  break;
5333  }
5334  return curr_field;
5335 }
COB_EXPIMP cob_field* cob_intr_max ( const int  ,
  ... 
)

References cob_cmp(), curr_field, cob_field::data, make_field_entry(), params, and cob_field::size.

4039 {
4040  cob_field *f;
4041  cob_field *basef;
4042  va_list args;
4043  int i;
4044 
4045  va_start (args, params);
4046 
4047  basef = va_arg (args, cob_field *);
4048  for (i = 1; i < params; ++i) {
4049  f = va_arg (args, cob_field *);
4050  if (cob_cmp (f, basef) > 0) {
4051  basef = f;
4052  }
4053  }
4054  va_end (args);
4055 
4056  make_field_entry (basef);
4057  memcpy (curr_field->data, basef->data, basef->size);
4058  return curr_field;
4059 }
COB_EXPIMP cob_field* cob_intr_mean ( const int  ,
  ... 
)

References cob_alloc_field(), cob_decimal_add(), cob_decimal_div(), cob_decimal_get_field(), cob_decimal_set_field(), cob_uli_t, curr_field, cob_field::data, make_field_entry(), params, cob_decimal::scale, cob_field::size, and cob_decimal::value.

4147 {
4148  cob_field *f;
4149  va_list args;
4150  int i;
4151 
4152  va_start (args, params);
4153 
4154  if (params == 1) {
4155  f = va_arg (args, cob_field *);
4156  va_end (args);
4157  make_field_entry (f);
4158  memcpy (curr_field->data, f->data, f->size);
4159  return curr_field;
4160  }
4161 
4162  mpz_set_ui (d1.value, 0UL);
4163  d1.scale = 0;
4164 
4165  for (i = 0; i < params; ++i) {
4166  f = va_arg (args, cob_field *);
4167  cob_decimal_set_field (&d2, f);
4168  cob_decimal_add (&d1, &d2);
4169  }
4170  va_end (args);
4171 
4172  mpz_set_ui (d2.value, (cob_uli_t)params);
4173  d2.scale = 0;
4174  cob_decimal_div (&d1, &d2);
4175 
4176  cob_alloc_field (&d1);
4177  (void)cob_decimal_get_field (&d1, curr_field, 0);
4178 
4179  return curr_field;
4180 }
COB_EXPIMP cob_field* cob_intr_median ( const int  ,
  ... 
)

References cob_alloc_field(), cob_decimal_add(), cob_decimal_div(), cob_decimal_get_field(), cob_decimal_set_field(), cob_free(), cob_malloc(), comp_field(), curr_field, cob_field::data, make_field_entry(), params, cob_decimal::scale, cob_field::size, and cob_decimal::value.

4099 {
4100  cob_field *f;
4101  cob_field **field_alloc;
4102  va_list args;
4103  int i;
4104 
4105  va_start (args, params);
4106 
4107  f = va_arg (args, cob_field *);
4108  if (params == 1) {
4109  va_end (args);
4110  make_field_entry (f);
4111  memcpy (curr_field->data, f->data, f->size);
4112  return curr_field;
4113  }
4114 
4115  field_alloc = cob_malloc ((size_t)params * sizeof (cob_field *));
4116  field_alloc[0] = f;
4117 
4118  for (i = 1; i < params; ++i) {
4119  field_alloc[i] = va_arg (args, cob_field *);
4120  }
4121  va_end (args);
4122 
4123  qsort (field_alloc, (size_t)params, (size_t)sizeof (cob_field *),
4124  comp_field);
4125 
4126  i = params / 2;
4127  if (params % 2) {
4128  f = field_alloc[i];
4129  make_field_entry (f);
4130  memcpy (curr_field->data, f->data, f->size);
4131  } else {
4132  cob_decimal_set_field (&d1, field_alloc[i-1]);
4133  cob_decimal_set_field (&d2, field_alloc[i]);
4134  cob_decimal_add (&d1, &d2);
4135  mpz_set_ui (d2.value, 2UL);
4136  d2.scale = 0;
4137  cob_decimal_div (&d1, &d2);
4138  cob_alloc_field (&d1);
4139  (void)cob_decimal_get_field (&d1, curr_field, 0);
4140  }
4141  cob_free (field_alloc);
4142  return curr_field;
4143 }
COB_EXPIMP cob_field* cob_intr_midrange ( const int  ,
  ... 
)

References cob_alloc_field(), cob_cmp(), cob_decimal_add(), cob_decimal_div(), cob_decimal_get_field(), cob_decimal_set_field(), curr_field, params, cob_decimal::scale, and cob_decimal::value.

4063 {
4064  cob_field *f;
4065  cob_field *basemin;
4066  cob_field *basemax;
4067  va_list args;
4068  int i;
4069 
4070  va_start (args, params);
4071 
4072  basemin = va_arg (args, cob_field *);
4073  basemax = basemin;
4074  for (i = 1; i < params; ++i) {
4075  f = va_arg (args, cob_field *);
4076  if (cob_cmp (f, basemin) < 0) {
4077  basemin = f;
4078  }
4079  if (cob_cmp (f, basemax) > 0) {
4080  basemax = f;
4081  }
4082  }
4083  va_end (args);
4084 
4085  cob_decimal_set_field (&d1, basemin);
4086  cob_decimal_set_field (&d2, basemax);
4087  cob_decimal_add (&d1, &d2);
4088  mpz_set_ui (d2.value, 2UL);
4089  d2.scale = 0;
4090  cob_decimal_div (&d1, &d2);
4091 
4092  cob_alloc_field (&d1);
4093  (void)cob_decimal_get_field (&d1, curr_field, 0);
4094  return curr_field;
4095 }
COB_EXPIMP cob_field* cob_intr_min ( const int  ,
  ... 
)

References cob_cmp(), curr_field, cob_field::data, make_field_entry(), params, and cob_field::size.

4015 {
4016  cob_field *f;
4017  cob_field *basef;
4018  va_list args;
4019  int i;
4020 
4021  va_start (args, params);
4022 
4023  basef = va_arg (args, cob_field *);
4024  for (i = 1; i < params; ++i) {
4025  f = va_arg (args, cob_field *);
4026  if (cob_cmp (f, basef) < 0) {
4027  basef = f;
4028  }
4029  }
4030  va_end (args);
4031 
4032  make_field_entry (basef);
4033  memcpy (curr_field->data, basef->data, basef->size);
4034  return curr_field;
4035 }
COB_EXPIMP cob_field* cob_intr_mod ( cob_field ,
cob_field  
)

References cob_mod_or_rem().

4184 {
4185  return cob_mod_or_rem (srcfield1, srcfield2, 0);
4186 }
COB_EXPIMP cob_field* cob_intr_module_caller_id ( void  )

References COB_FIELD_INIT, COB_MODULE_PTR, curr_field, cob_field::data, make_field_entry(), NULL, and cob_field::size.

2398 {
2399  size_t calcsize;
2400  cob_field field;
2401 
2402  if (!COB_MODULE_PTR->next) {
2404  make_field_entry (&field);
2405  curr_field->size = 0;
2406  curr_field->data[0] = ' ';
2407  return curr_field;
2408  }
2409  calcsize = strlen (COB_MODULE_PTR->next->module_name);
2410  COB_FIELD_INIT (calcsize, NULL, &const_alpha_attr);
2411  make_field_entry (&field);
2412  memcpy (curr_field->data, COB_MODULE_PTR->next->module_name,
2413  calcsize);
2414  return curr_field;
2415 }
COB_EXPIMP cob_field* cob_intr_module_date ( void  )

References COB_ATTR_INIT, COB_FIELD_INIT, COB_MODULE_PTR, COB_TYPE_NUMERIC_DISPLAY, curr_field, cob_field::data, make_field_entry(), and NULL.

2355 {
2356  cob_field_attr attr;
2357  cob_field field;
2358  char buff[16];
2359 
2360  COB_ATTR_INIT (COB_TYPE_NUMERIC_DISPLAY, 8, 0, 0, NULL);
2361  COB_FIELD_INIT (8, NULL, &attr);
2362  make_field_entry (&field);
2363  snprintf (buff, sizeof(buff), "%8.8u", COB_MODULE_PTR->module_date);
2364  memcpy (curr_field->data, buff, (size_t)8);
2365  return curr_field;
2366 }
COB_EXPIMP cob_field* cob_intr_module_formatted_date ( void  )

References COB_FIELD_INIT, COB_MODULE_PTR, curr_field, cob_field::data, make_field_entry(), and NULL.

2419 {
2420  size_t calcsize;
2421  cob_field field;
2422 
2423  calcsize = strlen (COB_MODULE_PTR->module_formatted_date);
2424  COB_FIELD_INIT (calcsize, NULL, &const_alpha_attr);
2425  make_field_entry (&field);
2426  memcpy (curr_field->data, COB_MODULE_PTR->module_formatted_date,
2427  calcsize);
2428  return curr_field;
2429 }
COB_EXPIMP cob_field* cob_intr_module_id ( void  )

References COB_FIELD_INIT, COB_MODULE_PTR, curr_field, cob_field::data, make_field_entry(), and NULL.

2385 {
2386  size_t calcsize;
2387  cob_field field;
2388 
2389  calcsize = strlen (COB_MODULE_PTR->module_name);
2390  COB_FIELD_INIT (calcsize, NULL, &const_alpha_attr);
2391  make_field_entry (&field);
2392  memcpy (curr_field->data, COB_MODULE_PTR->module_name, calcsize);
2393  return curr_field;
2394 }
COB_EXPIMP cob_field* cob_intr_module_path ( void  )

References COB_FIELD_INIT, COB_MODULE_PTR, curr_field, cob_field::data, make_field_entry(), NULL, and cob_field::size.

2446 {
2447  size_t calcsize;
2448  cob_field field;
2449 
2450  if (!COB_MODULE_PTR->module_path ||
2451  !*(COB_MODULE_PTR->module_path)) {
2453  make_field_entry (&field);
2454  curr_field->size = 0;
2455  curr_field->data[0] = ' ';
2456  return curr_field;
2457  }
2458  calcsize = strlen (*(COB_MODULE_PTR->module_path));
2459  COB_FIELD_INIT (calcsize, NULL, &const_alpha_attr);
2460  make_field_entry (&field);
2461  memcpy (curr_field->data, *(COB_MODULE_PTR->module_path),
2462  calcsize);
2463  return curr_field;
2464 }
COB_EXPIMP cob_field* cob_intr_module_source ( void  )

References COB_FIELD_INIT, COB_MODULE_PTR, curr_field, cob_field::data, make_field_entry(), and NULL.

2433 {
2434  size_t calcsize;
2435  cob_field field;
2436 
2437  calcsize = strlen (COB_MODULE_PTR->module_source);
2438  COB_FIELD_INIT (calcsize, NULL, &const_alpha_attr);
2439  make_field_entry (&field);
2440  memcpy (curr_field->data, COB_MODULE_PTR->module_source, calcsize);
2441  return curr_field;
2442 }
COB_EXPIMP cob_field* cob_intr_module_time ( void  )

References COB_ATTR_INIT, COB_FIELD_INIT, COB_MODULE_PTR, COB_TYPE_NUMERIC_DISPLAY, curr_field, cob_field::data, make_field_entry(), and NULL.

2370 {
2371  cob_field_attr attr;
2372  cob_field field;
2373  char buff[8];
2374 
2375  COB_ATTR_INIT (COB_TYPE_NUMERIC_DISPLAY, 6, 0, 0, NULL);
2376  COB_FIELD_INIT (6, NULL, &attr);
2377  make_field_entry (&field);
2378  snprintf (buff, sizeof(buff), "%6.6u", COB_MODULE_PTR->module_time);
2379  memcpy (curr_field->data, buff, (size_t)6);
2380  return curr_field;
2381 }
COB_EXPIMP cob_field* cob_intr_mon_decimal_point ( void  )

References COB_FIELD_INIT, COB_MODULE_PTR, cob_set_exception(), curr_field, cob_field::data, make_field_entry(), NULL, p, and cob_field::size.

5071 {
5072 #ifdef HAVE_LOCALECONV
5073  struct lconv *p;
5074  size_t size;
5075 #endif
5076  cob_field field;
5077 
5079  cob_set_exception (0);
5080 
5081 #ifdef HAVE_LOCALECONV
5082  p = localeconv ();
5083  size = strlen (p->mon_decimal_point);
5084  if (size) {
5085  field.size = size;
5086  } else {
5087  field.size = 1;
5088  }
5089  make_field_entry (&field);
5090  if (size) {
5091  memcpy (curr_field->data, p->mon_decimal_point, size);
5092  } else {
5093  curr_field->size = 0;
5094  curr_field->data[0] = 0;
5095  }
5096 #else
5097  field.size = 1;
5098  make_field_entry (&field);
5099  curr_field->data[0] = COB_MODULE_PTR->decimal_point;
5100 #endif
5101  return curr_field;
5102 }
COB_EXPIMP cob_field* cob_intr_mon_thousands_sep ( void  )

References COB_FIELD_INIT, COB_MODULE_PTR, cob_set_exception(), curr_field, cob_field::data, make_field_entry(), NULL, p, and cob_field::size.

5141 {
5142 #ifdef HAVE_LOCALECONV
5143  struct lconv *p;
5144  size_t size;
5145 #endif
5146  cob_field field;
5147 
5149  cob_set_exception (0);
5150 
5151 #ifdef HAVE_LOCALECONV
5152  p = localeconv ();
5153  size = strlen (p->mon_thousands_sep);
5154  if (size) {
5155  field.size = size;
5156  } else {
5157  field.size = 1;
5158  }
5159  make_field_entry (&field);
5160  if (size) {
5161  memcpy (curr_field->data, p->mon_thousands_sep, size);
5162  } else {
5163  curr_field->size = 0;
5164  curr_field->data[0] = 0;
5165  }
5166 #else
5167  field.size = 1;
5168  make_field_entry (&field);
5169  curr_field->data[0] = COB_MODULE_PTR->decimal_point;
5170 #endif
5171  return curr_field;
5172 }
COB_EXPIMP cob_field* cob_intr_national_of ( const int  ,
const int  ,
const int  ,
  ... 
)

References cob_fatal_error(), COB_FERROR_FUNCTION, and COB_UNUSED.

5797 {
5798  COB_UNUSED (offset);
5799  COB_UNUSED (length);
5800  COB_UNUSED (params);
5801 
5802  cob_fatal_error (COB_FERROR_FUNCTION);
5803 }
COB_EXPIMP cob_field* cob_intr_num_decimal_point ( void  )

References COB_FIELD_INIT, COB_MODULE_PTR, cob_set_exception(), curr_field, cob_field::data, make_field_entry(), NULL, p, and cob_field::size.

5106 {
5107 #ifdef HAVE_LOCALECONV
5108  struct lconv *p;
5109  size_t size;
5110 #endif
5111  cob_field field;
5112 
5114  cob_set_exception (0);
5115 
5116 #ifdef HAVE_LOCALECONV
5117  p = localeconv ();
5118  size = strlen (p->decimal_point);
5119  if (size) {
5120  field.size = size;
5121  } else {
5122  field.size = 1;
5123  }
5124  make_field_entry (&field);
5125  if (size) {
5126  memcpy (curr_field->data, p->decimal_point, size);
5127  } else {
5128  curr_field->size = 0;
5129  curr_field->data[0] = 0;
5130  }
5131 #else
5132  field.size = 1;
5133  make_field_entry (&field);
5134  curr_field->data[0] = COB_MODULE_PTR->decimal_point;
5135 #endif
5136  return curr_field;
5137 }
COB_EXPIMP cob_field* cob_intr_num_thousands_sep ( void  )

References COB_FIELD_INIT, COB_MODULE_PTR, cob_set_exception(), curr_field, cob_field::data, make_field_entry(), NULL, p, and cob_field::size.

5176 {
5177 #ifdef HAVE_LOCALECONV
5178  struct lconv *p;
5179  size_t size;
5180 #endif
5181  cob_field field;
5182 
5184  cob_set_exception (0);
5185 
5186 #ifdef HAVE_LOCALECONV
5187  p = localeconv ();
5188  size = strlen (p->thousands_sep);
5189  if (size) {
5190  field.size = size;
5191  } else {
5192  field.size = 1;
5193  }
5194  make_field_entry (&field);
5195  if (size) {
5196  memcpy (curr_field->data, p->thousands_sep, size);
5197  } else {
5198  curr_field->size = 0;
5199  curr_field->data[0] = 0;
5200  }
5201 #else
5202  field.size = 1;
5203  make_field_entry (&field);
5204  curr_field->data[0] = COB_MODULE_PTR->decimal_point;
5205 #endif
5206  return curr_field;
5207 }
COB_EXPIMP cob_field* cob_intr_numval ( cob_field )

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_check_numval(), cob_decimal_get_field(), COB_EC_ARGUMENT_FUNCTION, cob_free(), cob_malloc(), COB_MAX_DIGITS, COB_MODULE_PTR, cob_set_exception(), curr_field, cob_field::data, NULL, cob_decimal::scale, sign, cob_field::size, and cob_decimal::value.

3608 {
3609  unsigned char *final_buff;
3610  size_t i;
3611  int final_digits;
3612  int decimal_digits;
3613  int sign;
3614  int decimal_seen;
3615  unsigned char dec_pt;
3616 
3617  /* Validate source field */
3618  if (cob_check_numval (srcfield, NULL, 0, 0)) {
3621  return curr_field;
3622  }
3623 
3624  final_digits = 0;
3625  decimal_digits = 0;
3626  sign = 0;
3627  decimal_seen = 0;
3628  dec_pt = COB_MODULE_PTR->decimal_point;
3629  final_buff = cob_malloc (srcfield->size + 1U);
3630 
3631  for (i = 0; i < srcfield->size; ++i) {
3632  if (i < (srcfield->size - 1)) {
3633  if (memcmp (&srcfield->data[i], "CR", (size_t)2) == 0 ||
3634  memcmp (&srcfield->data[i], "DB", (size_t)2) == 0) {
3635  sign = 1;
3636  break;
3637  }
3638  }
3639  if (srcfield->data[i] == ' ') {
3640  continue;
3641  }
3642  if (srcfield->data[i] == '+') {
3643  continue;
3644  }
3645  if (srcfield->data[i] == '-') {
3646  sign = 1;
3647  continue;
3648  }
3649  if (srcfield->data[i] == dec_pt) {
3650  decimal_seen = 1;
3651  continue;
3652  }
3653  if (srcfield->data[i] >= (unsigned char)'0' &&
3654  srcfield->data[i] <= (unsigned char)'9') {
3655  if (decimal_seen) {
3656  decimal_digits++;
3657  }
3658  final_buff[final_digits++] = srcfield->data[i];
3659  }
3660  if (final_digits > COB_MAX_DIGITS) {
3661  break;
3662  }
3663  }
3664 
3665  if (!final_digits) {
3666  final_buff[0] = '0';
3667  }
3668  mpz_set_str (d1.value, (char *)final_buff, 10);
3669  cob_free (final_buff);
3670  if (sign && mpz_sgn (d1.value)) {
3671  mpz_neg (d1.value, d1.value);
3672  }
3673  d1.scale = decimal_digits;
3674  cob_alloc_field (&d1);
3675  (void)cob_decimal_get_field (&d1, curr_field, 0);
3676 
3677  return curr_field;
3678 }
COB_EXPIMP cob_field* cob_intr_numval_c ( cob_field ,
cob_field  
)

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_check_numval(), cob_decimal_get_field(), COB_EC_ARGUMENT_FUNCTION, cob_free(), cob_malloc(), COB_MAX_DIGITS, COB_MODULE_PTR, cob_set_exception(), curr_field, cob_field::data, NULL, cob_decimal::scale, sign, cob_field::size, and cob_decimal::value.

3682 {
3683  unsigned char *final_buff;
3684  unsigned char *currency_data;
3685  size_t i;
3686  int decimal_digits;
3687  int final_digits;
3688  int sign;
3689  int decimal_seen;
3690  unsigned char dec_pt;
3691  unsigned char cur_symb;
3692 
3693  /* Validate source field */
3694  if (cob_check_numval (srcfield, currency, 1, 0)) {
3697  return curr_field;
3698  }
3699 
3700  decimal_digits = 0;
3701  final_digits = 0;
3702  sign = 0;
3703  decimal_seen = 0;
3704  dec_pt = COB_MODULE_PTR->decimal_point;
3705  cur_symb = COB_MODULE_PTR->currency_symbol;
3706  final_buff = cob_malloc (srcfield->size + 1U);
3707 
3708  currency_data = NULL;
3709  if (currency) {
3710  if (currency->size < srcfield->size) {
3711  currency_data = currency->data;
3712  }
3713  }
3714  for (i = 0; i < srcfield->size; ++i) {
3715  if (i < (srcfield->size - 1)) {
3716  if (memcmp (&srcfield->data[i], "CR", (size_t)2) == 0 ||
3717  memcmp (&srcfield->data[i], "DB", (size_t)2) == 0) {
3718  sign = 1;
3719  break;
3720  }
3721  }
3722  if (currency_data) {
3723  if (i < (srcfield->size - currency->size)) {
3724  if (!memcmp (&srcfield->data[i],
3725  currency_data, currency->size)) {
3726  i += (currency->size - 1);
3727  continue;
3728  }
3729  }
3730  } else if (srcfield->data[i] == cur_symb) {
3731  continue;
3732  }
3733  if (srcfield->data[i] == ' ') {
3734  continue;
3735  }
3736  if (srcfield->data[i] == '+') {
3737  continue;
3738  }
3739  if (srcfield->data[i] == '-') {
3740  sign = 1;
3741  continue;
3742  }
3743  if (srcfield->data[i] == dec_pt) {
3744  decimal_seen = 1;
3745  continue;
3746  }
3747  if (srcfield->data[i] >= (unsigned char)'0' &&
3748  srcfield->data[i] <= (unsigned char)'9') {
3749  if (decimal_seen) {
3750  decimal_digits++;
3751  }
3752  final_buff[final_digits++] = srcfield->data[i];
3753  }
3754  if (final_digits > COB_MAX_DIGITS) {
3755  break;
3756  }
3757  }
3758 
3759  if (!final_digits) {
3760  final_buff[0] = '0';
3761  }
3762  mpz_set_str (d1.value, (char *)final_buff, 10);
3763  cob_free (final_buff);
3764  if (sign && mpz_sgn (d1.value)) {
3765  mpz_neg (d1.value, d1.value);
3766  }
3767  d1.scale = decimal_digits;
3768  cob_alloc_field (&d1);
3769  (void)cob_decimal_get_field (&d1, curr_field, 0);
3770 
3771  return curr_field;
3772 }
COB_EXPIMP cob_field* cob_intr_numval_f ( cob_field )

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_check_numval_f(), cob_decimal_get_field(), COB_EC_ARGUMENT_FUNCTION, cob_free(), cob_malloc(), cob_mexp, COB_MODULE_PTR, cob_set_exception(), cob_uli_t, curr_field, cob_field::data, p, cob_decimal::scale, cob_field::size, and cob_decimal::value.

3776 {
3777  unsigned char *final_buff;
3778  unsigned char *p;
3779  size_t plus_minus;
3780  size_t digits;
3781  size_t decimal_digits;
3782  size_t dec_seen;
3783  size_t e_seen;
3784  size_t exponent;
3785  size_t e_plus_minus;
3786  size_t n;
3787  unsigned char dec_pt;
3788 
3789  /* Validate source field */
3790  if (cob_check_numval_f (srcfield)) {
3793  return curr_field;
3794  }
3795 
3796  plus_minus = 0;
3797  digits = 0;
3798  decimal_digits = 0;
3799  dec_seen = 0;
3800  e_seen = 0;
3801  exponent = 0;
3802  e_plus_minus = 0;
3803  dec_pt = COB_MODULE_PTR->decimal_point;
3804 
3805  final_buff = cob_malloc (srcfield->size + 1U);
3806  p = srcfield->data;
3807  for (n = 0; n < srcfield->size; ++n, ++p) {
3808  switch (*p) {
3809  case '0':
3810  case '1':
3811  case '2':
3812  case '3':
3813  case '4':
3814  case '5':
3815  case '6':
3816  case '7':
3817  case '8':
3818  case '9':
3819  if (e_seen) {
3820  exponent *= 10;
3821  exponent += (*p & 0x0F);
3822  } else {
3823  if (dec_seen) {
3824  decimal_digits++;
3825  }
3826  final_buff[digits++] = *p;
3827  }
3828  continue;
3829  case 'E':
3830  e_seen = 1;
3831  continue;
3832  case '-':
3833  if (e_seen) {
3834  e_plus_minus = 1;
3835  } else {
3836  plus_minus = 1;
3837  }
3838  continue;
3839  default:
3840  if (*p == dec_pt) {
3841  dec_seen = 1;
3842  }
3843  continue;
3844  }
3845  }
3846 
3847  if (!digits) {
3848  final_buff[0] = '0';
3849  }
3850 
3851  mpz_set_str (d1.value, (char *)final_buff, 10);
3852  cob_free (final_buff);
3853  if (!mpz_sgn (d1.value)) {
3854  /* Value is zero ; sign and exponent irrelevant */
3855  d1.scale = 0;
3856  cob_alloc_field (&d1);
3857  (void)cob_decimal_get_field (&d1, curr_field, 0);
3858  return curr_field;
3859  }
3860  if (plus_minus) {
3861  mpz_neg (d1.value, d1.value);
3862  }
3863  if (exponent) {
3864  if (e_plus_minus) {
3865  /* Negative exponent */
3866  d1.scale = decimal_digits + exponent;
3867  } else {
3868  /* Positive exponent */
3869  if (decimal_digits >= exponent) {
3870  d1.scale = decimal_digits - exponent;
3871  } else {
3872  exponent -= decimal_digits;
3873  mpz_ui_pow_ui (cob_mexp, 10UL,
3874  (cob_uli_t)exponent);
3875  mpz_mul (d1.value, d1.value, cob_mexp);
3876  d1.scale = 0;
3877  }
3878  }
3879  } else {
3880  /* No exponent */
3881  d1.scale = decimal_digits;
3882  }
3883 
3884  cob_alloc_field (&d1);
3885  (void)cob_decimal_get_field (&d1, curr_field, 0);
3886 
3887  return curr_field;
3888 }
COB_EXPIMP cob_field* cob_intr_ord ( cob_field )

References cob_alloc_set_field_uint(), cob_u32_t, curr_field, and cob_field::data.

2982 {
2983  cob_alloc_set_field_uint ((cob_u32_t)(*srcfield->data + 1U));
2984  return curr_field;
2985 }
COB_EXPIMP cob_field* cob_intr_ord_max ( const int  ,
  ... 
)

References cob_alloc_set_field_uint(), cob_cmp(), cob_u32_t, curr_field, and params.

3989 {
3990  cob_field *f;
3991  cob_field *basef;
3992  cob_u32_t ordmax;
3993  int i;
3994  va_list args;
3995 
3996  va_start (args, params);
3997 
3998  ordmax = 1;
3999  basef = va_arg (args, cob_field *);
4000  for (i = 1; i < params; ++i) {
4001  f = va_arg (args, cob_field *);
4002  if (cob_cmp (f, basef) > 0) {
4003  basef = f;
4004  ordmax = i + 1;
4005  }
4006  }
4007  va_end (args);
4008 
4009  cob_alloc_set_field_uint (ordmax);
4010  return curr_field;
4011 }
COB_EXPIMP cob_field* cob_intr_ord_min ( const int  ,
  ... 
)

References cob_alloc_set_field_uint(), cob_cmp(), cob_u32_t, curr_field, and params.

3963 {
3964  cob_field *f;
3965  cob_field *basef;
3966  int i;
3967  cob_u32_t ordmin;
3968  va_list args;
3969 
3970  va_start (args, params);
3971 
3972  ordmin = 1;
3973  basef = va_arg (args, cob_field *);
3974  for (i = 1; i < params; ++i) {
3975  f = va_arg (args, cob_field *);
3976  if (cob_cmp (f, basef) < 0) {
3977  basef = f;
3978  ordmin = i + 1;
3979  }
3980  }
3981  va_end (args);
3982 
3983  cob_alloc_set_field_uint (ordmin);
3984  return curr_field;
3985 }
COB_EXPIMP cob_field* cob_intr_pi ( void  )

References cob_alloc_field(), cob_decimal_get_field(), cob_decimal_set_mpf(), cob_mpft, cob_pi, and curr_field.

3298 {
3299  mpf_set (cob_mpft, cob_pi);
3301  cob_alloc_field (&d1);
3302  (void)cob_decimal_get_field (&d1, curr_field, 0);
3303 
3304  return curr_field;
3305 }
COB_EXPIMP cob_field* cob_intr_present_value ( const int  ,
  ... 
)

References cob_alloc_field(), cob_decimal_add(), cob_decimal_div(), cob_decimal_get_field(), cob_decimal_set_field(), cob_uli_t, curr_field, params, cob_decimal::scale, and cob_decimal::value.

4390 {
4391  cob_field *f;
4392  va_list args;
4393  int i;
4394 
4395  va_start (args, params);
4396 
4397  f = va_arg (args, cob_field *);
4398 
4399  cob_decimal_set_field (&d1, f);
4400  mpz_set_ui (d2.value, 1UL);
4401  d2.scale = 0;
4402  cob_decimal_add (&d1, &d2);
4403 
4404  mpz_set_ui (d4.value, 0UL);
4405  d4.scale = 0;
4406 
4407  for (i = 1; i < params; ++i) {
4408  f = va_arg (args, cob_field *);
4409  cob_decimal_set_field (&d2, f);
4410  mpz_set (d3.value, d1.value);
4411  d3.scale = d1.scale;
4412  if (i > 1) {
4413  mpz_pow_ui (d3.value, d3.value, (cob_uli_t)i);
4414  d3.scale *= i;
4415  }
4416  cob_decimal_div (&d2, &d3);
4417  cob_decimal_add (&d4, &d2);
4418  }
4419  va_end (args);
4420 
4421  cob_alloc_field (&d4);
4422  (void)cob_decimal_get_field (&d4, curr_field, 0);
4423  return curr_field;
4424 }
COB_EXPIMP cob_field* cob_intr_random ( const int  ,
  ... 
)

References COB_ATTR_INIT, COB_FIELD_INIT, COB_FLAG_HAVE_SIGN, cob_get_int(), COB_TYPE_NUMERIC_DOUBLE, curr_field, cob_field::data, make_field_entry(), and NULL.

4227 {
4228  cob_field *f;
4229  va_list args;
4230  double val;
4231  int seed;
4232  int randnum;
4233  cob_field_attr attr;
4234  cob_field field;
4235 
4236  COB_ATTR_INIT (COB_TYPE_NUMERIC_DOUBLE, 20, 9, COB_FLAG_HAVE_SIGN, NULL);
4237  COB_FIELD_INIT (sizeof(double), NULL, &attr);
4238  va_start (args, params);
4239 
4240  if (params) {
4241  f = va_arg (args, cob_field *);
4242  seed = cob_get_int (f);
4243  if (seed < 0) {
4244  seed = 0;
4245  }
4246 #ifdef __CYGWIN__
4247  srandom ((unsigned int)seed);
4248 #else
4249  srand ((unsigned int)seed);
4250 #endif
4251  }
4252  va_end (args);
4253 
4254 #ifdef __CYGWIN__
4255  randnum = (int)random ();
4256 #else
4257  randnum = rand ();
4258 #endif
4259  make_field_entry (&field);
4260  val = (double)randnum / (double)RAND_MAX;
4261  memcpy (curr_field->data, &val, sizeof(val));
4262  return curr_field;
4263 }
COB_EXPIMP cob_field* cob_intr_range ( const int  ,
  ... 
)

References cob_alloc_field(), cob_cmp(), cob_decimal_get_field(), cob_decimal_set_field(), cob_decimal_sub(), curr_field, and params.

4190 {
4191  cob_field *f, *basemin, *basemax;
4192  va_list args;
4193  int i;
4194 
4195  va_start (args, params);
4196 
4197  basemin = va_arg (args, cob_field *);
4198  basemax = basemin;
4199  for (i = 1; i < params; ++i) {
4200  f = va_arg (args, cob_field *);
4201  if (cob_cmp (f, basemin) < 0) {
4202  basemin = f;
4203  }
4204  if (cob_cmp (f, basemax) > 0) {
4205  basemax = f;
4206  }
4207  }
4208  va_end (args);
4209 
4210  cob_decimal_set_field (&d1, basemax);
4211  cob_decimal_set_field (&d2, basemin);
4212  cob_decimal_sub (&d1, &d2);
4213 
4214  cob_alloc_field (&d1);
4215  (void)cob_decimal_get_field (&d1, curr_field, 0);
4216  return curr_field;
4217 }
COB_EXPIMP cob_field* cob_intr_rem ( cob_field ,
cob_field  
)

References cob_mod_or_rem().

4221 {
4222  return cob_mod_or_rem (srcfield1, srcfield2, 1);
4223 }
COB_EXPIMP cob_field* cob_intr_reverse ( const int  ,
const int  ,
cob_field  
)

References calc_ref_mod(), curr_field, cob_field::data, make_field_entry(), cob_field::size, and unlikely.

2338 {
2339  size_t i, size;
2340 
2341  make_field_entry (srcfield);
2342 
2343  size = srcfield->size;
2344  for (i = 0; i < size; ++i) {
2345  curr_field->data[i] = srcfield->data[size - i - 1];
2346  }
2347  if (unlikely(offset > 0)) {
2348  calc_ref_mod (curr_field, offset, length);
2349  }
2350  return curr_field;
2351 }
COB_EXPIMP cob_field* cob_intr_seconds_from_formatted_time ( cob_field ,
cob_field  
)

References cob_alloc_set_field_uint(), COB_EC_ARGUMENT_FUNCTION, cob_set_exception(), cob_u32_t, curr_field, cob_field::data, and cob_field::size.

4628 {
4629  unsigned char *p1;
4630  unsigned char *p2;
4631  size_t n;
4632  cob_u32_t seconds = 0;
4633  cob_u32_t minutes = 0;
4634  cob_u32_t hours = 0;
4635  cob_u32_t seconds_seen = 0;
4636  cob_u32_t minutes_seen = 0;
4637  cob_u32_t hours_seen = 0;
4638 
4639  cob_set_exception (0);
4640  if (value->size < format->size) {
4643  return curr_field;
4644  }
4645  p1 = format->data;
4646  p2 = value->data;
4647  for (n = 0; n < format->size - 1; ++n, ++p1, ++p2) {
4648  if (!memcmp (p1, "hh", (size_t)2) && !hours_seen) {
4649  if (*p2 >= (unsigned char)'0' &&
4650  *p2 <= (unsigned char)'9' &&
4651  *(p2 + 1) >= (unsigned char)'0' &&
4652  *(p2 + 1) <= (unsigned char)'9') {
4653  hours = ((*p2 - '0') * 10) + (*(p2 + 1) - '0');
4654  hours_seen = 1;
4655  continue;
4656  }
4657  }
4658  if (!memcmp (p1, "mm", (size_t)2) && !minutes_seen) {
4659  if (*p2 >= (unsigned char)'0' &&
4660  *p2 <= (unsigned char)'9' &&
4661  *(p2 + 1) >= (unsigned char)'0' &&
4662  *(p2 + 1) <= (unsigned char)'9') {
4663  minutes = ((*p2 - '0') * 10) + (*(p2 + 1) - '0');
4664  minutes_seen = 1;
4665  continue;
4666  }
4667  }
4668  if (!memcmp (p1, "ss", (size_t)2) && !seconds_seen) {
4669  if (*p2 >= (unsigned char)'0' &&
4670  *p2 <= (unsigned char)'9' &&
4671  *(p2 + 1) >= (unsigned char)'0' &&
4672  *(p2 + 1) <= (unsigned char)'9') {
4673  seconds = ((*p2 - '0') * 10) + (*(p2 + 1) - '0');
4674  seconds_seen = 1;
4675  continue;
4676  }
4677  }
4678  }
4679  if (hours_seen && minutes_seen && seconds_seen) {
4680  seconds += (hours * 3600) + (minutes * 60);
4681  } else {
4683  seconds = 0;
4684  }
4685  cob_alloc_set_field_uint (seconds);
4686  return curr_field;
4687 }
COB_EXPIMP cob_field* cob_intr_seconds_past_midnight ( void  )

References cob_alloc_set_field_int(), curr_field, and NULL.

4609 {
4610  struct tm *timeptr;
4611  time_t t;
4612  int seconds;
4613 
4614  t = time (NULL);
4615  timeptr = localtime (&t);
4616  /* Leap seconds ? */
4617  if (timeptr->tm_sec >= 60) {
4618  timeptr->tm_sec = 59;
4619  }
4620  seconds = (timeptr->tm_hour * 3600) + (timeptr->tm_min * 60) +
4621  timeptr->tm_sec;
4622  cob_alloc_set_field_int (seconds);
4623  return curr_field;
4624 }
COB_EXPIMP cob_field* cob_intr_sign ( cob_field )

References cob_alloc_set_field_int(), cob_decimal_set_field(), curr_field, and cob_decimal::value.

2296 {
2297  cob_decimal_set_field (&d1, srcfield);
2298  cob_alloc_set_field_int (mpz_sgn (d1.value));
2299  return curr_field;
2300 }
COB_EXPIMP cob_field* cob_intr_sqrt ( cob_field )

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_decimal_get_field(), cob_decimal_pow(), cob_decimal_set_field(), COB_EC_ARGUMENT_FUNCTION, cob_set_exception(), cob_trim_decimal(), curr_field, cob_decimal::scale, and cob_decimal::value.

3585 {
3586  cob_decimal_set_field (&d1, srcfield);
3587 
3588  cob_set_exception (0);
3589  if (mpz_sgn (d1.value) < 0) {
3592  return curr_field;
3593  }
3594 
3595  mpz_set_ui (d2.value, 5UL);
3596  d2.scale = 1;
3597  cob_trim_decimal (&d1);
3598  cob_decimal_pow (&d1, &d2);
3599 
3600  cob_alloc_field (&d1);
3601  (void)cob_decimal_get_field (&d1, curr_field, 0);
3602 
3603  return curr_field;
3604 }
COB_EXPIMP cob_field* cob_intr_standard_compare ( const int  ,
  ... 
)

References cob_fatal_error(), COB_FERROR_FUNCTION, and COB_UNUSED.

5807 {
5808  COB_UNUSED (params);
5809 
5810  cob_fatal_error (COB_FERROR_FUNCTION);
5811 }
COB_EXPIMP cob_field* cob_intr_standard_deviation ( const int  ,
  ... 
)

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_decimal_add(), cob_decimal_div(), cob_decimal_get_field(), cob_decimal_mul(), cob_decimal_pow(), cob_decimal_set_field(), cob_decimal_sub(), cob_set_exception(), cob_trim_decimal(), cob_uli_t, curr_field, params, cob_decimal::scale, and cob_decimal::value.

4322 {
4323  cob_field *f;
4324  va_list args;
4325  int i;
4326 
4327  va_start (args, params);
4328 
4329  if (params == 1) {
4330  va_end (args);
4332  return curr_field;
4333  }
4334 
4335  /* MEAN for all params */
4336  mpz_set_ui (d1.value, 0UL);
4337  d1.scale = 0;
4338 
4339  for (i = 0; i < params; ++i) {
4340  f = va_arg (args, cob_field *);
4341  cob_decimal_set_field (&d2, f);
4342  cob_decimal_add (&d1, &d2);
4343  }
4344  va_end (args);
4345 
4346  mpz_set_ui (d2.value, (cob_uli_t)params);
4347  d2.scale = 0;
4348  cob_decimal_div (&d1, &d2);
4349 
4350  /* Got the MEAN in d1, iterate again */
4351 
4352  mpz_set_ui (d4.value, 0UL);
4353  d4.scale = 0;
4354 
4355  va_start (args, params);
4356 
4357  for (i = 0; i < params; ++i) {
4358  f = va_arg (args, cob_field *);
4359  cob_decimal_set_field (&d2, f);
4360  cob_decimal_sub (&d2, &d1);
4361  cob_decimal_mul (&d2, &d2);
4362  cob_decimal_add (&d4, &d2);
4363  }
4364  va_end (args);
4365 
4366  mpz_set_ui (d3.value, (cob_uli_t)params);
4367  d3.scale = 0;
4368  cob_decimal_div (&d4, &d3);
4369 
4370  /* We have the VARIANCE in d4, sqrt = STANDARD-DEVIATION */
4371 
4372  cob_trim_decimal (&d4);
4373 
4374  cob_set_exception (0);
4375 
4376  mpz_set_ui (d3.value, 5UL);
4377  d3.scale = 1;
4378 
4379  cob_trim_decimal (&d4);
4380  cob_decimal_pow (&d4, &d3);
4381 
4382  cob_alloc_field (&d4);
4383  (void)cob_decimal_get_field (&d4, curr_field, 0);
4384 
4385  return curr_field;
4386 }
COB_EXPIMP cob_field* cob_intr_stored_char_length ( cob_field )

References cob_alloc_set_field_uint(), cob_u32_t, curr_field, cob_field::data, p, and cob_field::size.

2989 {
2990  unsigned char *p;
2991  cob_u32_t count;
2992 
2993  count = srcfield->size;
2994  p = srcfield->data + srcfield->size - 1;
2995  for (; count > 0; count--, p--) {
2996  if (*p != ' ') {
2997  break;
2998  }
2999  }
3000 
3001  cob_alloc_set_field_uint (count);
3002  return curr_field;
3003 }
COB_EXPIMP cob_field* cob_intr_substitute ( const int  ,
const int  ,
const int  ,
  ... 
)

References calc_ref_mod(), COB_FIELD_INIT, cob_free(), cob_malloc(), curr_field, cob_field::data, found, make_field_entry(), NULL, cob_field::size, and unlikely.

2508 {
2509  cob_field *var;
2510  cob_field **f1;
2511  cob_field **f2;
2512  unsigned char *p1;
2513  unsigned char *p2;
2514  size_t varsize;
2515  size_t calcsize;
2516  size_t n;
2517  size_t found;
2518  int numreps;
2519  int i;
2520  cob_field field;
2521  va_list args;
2522 
2523  numreps = params / 2;
2524  f1 = cob_malloc ((size_t)numreps * sizeof (cob_field *));
2525  f2 = cob_malloc ((size_t)numreps * sizeof (cob_field *));
2526 
2527  va_start (args, params);
2528 
2529  var = va_arg (args, cob_field *);
2530  varsize = var->size;
2531 
2532  /* Extract args */
2533  for (i = 0; i < params - 1; ++i) {
2534  if ((i % 2) == 0) {
2535  f1[i / 2] = va_arg (args, cob_field *);
2536  } else {
2537  f2[i / 2] = va_arg (args, cob_field *);
2538  }
2539  }
2540  va_end (args);
2541 
2542  /* Calculate required size */
2543  calcsize = 0;
2544  found = 0;
2545  p1 = var->data;
2546  for (n = 0; n < varsize; ) {
2547  for (i = 0; i < numreps; ++i) {
2548  if (n + f1[i]->size <= varsize) {
2549  if (!memcmp (p1, f1[i]->data, f1[i]->size)) {
2550  p1 += f1[i]->size;
2551  n += f1[i]->size;
2552  calcsize += f2[i]->size;
2553  found = 1;
2554  break;
2555  }
2556  }
2557  }
2558  if (found) {
2559  found = 0;
2560  continue;
2561  }
2562  ++n;
2563  ++p1;
2564  ++calcsize;
2565  }
2566 
2568  field.size = calcsize;
2569  make_field_entry (&field);
2570 
2571  found = 0;
2572  p1 = var->data;
2573  p2 = curr_field->data;
2574  for (n = 0; n < varsize; ) {
2575  for (i = 0; i < numreps; ++i) {
2576  if (n + f1[i]->size <= varsize) {
2577  if (!memcmp (p1, f1[i]->data, f1[i]->size)) {
2578  memcpy (p2, f2[i]->data, f2[i]->size);
2579  p1 += f1[i]->size;
2580  p2 += f2[i]->size;
2581  n += f1[i]->size;
2582  found = 1;
2583  break;
2584  }
2585  }
2586  }
2587  if (found) {
2588  found = 0;
2589  continue;
2590  }
2591  ++n;
2592  *p2++ = *p1++;
2593  }
2594  if (unlikely(offset > 0)) {
2595  calc_ref_mod (curr_field, offset, length);
2596  }
2597  cob_free (f1);
2598  cob_free (f2);
2599  return curr_field;
2600 }
COB_EXPIMP cob_field* cob_intr_substitute_case ( const int  ,
const int  ,
const int  ,
  ... 
)

References calc_ref_mod(), COB_FIELD_INIT, cob_free(), cob_malloc(), curr_field, cob_field::data, found, make_field_entry(), NULL, cob_field::size, and unlikely.

2605 {
2606  cob_field *var;
2607  cob_field **f1;
2608  cob_field **f2;
2609  unsigned char *p1;
2610  unsigned char *p2;
2611  size_t varsize;
2612  size_t calcsize;
2613  size_t n;
2614  size_t found;
2615  int numreps;
2616  int i;
2617  cob_field field;
2618  va_list args;
2619 
2620  numreps = params / 2;
2621  f1 = cob_malloc ((size_t)numreps * sizeof (cob_field *));
2622  f2 = cob_malloc ((size_t)numreps * sizeof (cob_field *));
2623 
2624  va_start (args, params);
2625 
2626  var = va_arg (args, cob_field *);
2627  varsize = var->size;
2628 
2629  /* Extract args */
2630  for (i = 0; i < params - 1; ++i) {
2631  if ((i % 2) == 0) {
2632  f1[i / 2] = va_arg (args, cob_field *);
2633  } else {
2634  f2[i / 2] = va_arg (args, cob_field *);
2635  }
2636  }
2637  va_end (args);
2638 
2639  /* Calculate required size */
2640  calcsize = 0;
2641  found = 0;
2642  p1 = var->data;
2643  for (n = 0; n < varsize; ) {
2644  for (i = 0; i < numreps; ++i) {
2645  if (n + f1[i]->size <= varsize) {
2646  if (!strncasecmp ((const char *)p1,
2647  (const char *)(f1[i]->data),
2648  f1[i]->size)) {
2649  p1 += f1[i]->size;
2650  n += f1[i]->size;
2651  calcsize += f2[i]->size;
2652  found = 1;
2653  break;
2654  }
2655  }
2656  }
2657  if (found) {
2658  found = 0;
2659  continue;
2660  }
2661  ++n;
2662  ++p1;
2663  ++calcsize;
2664  }
2665 
2667  field.size = calcsize;
2668  make_field_entry (&field);
2669 
2670  found = 0;
2671  p1 = var->data;
2672  p2 = curr_field->data;
2673  for (n = 0; n < varsize; ) {
2674  for (i = 0; i < numreps; ++i) {
2675  if (n + f1[i]->size <= varsize) {
2676  if (!strncasecmp ((const char *)p1,
2677  (const char *)(f1[i]->data),
2678  f1[i]->size)) {
2679  memcpy (p2, f2[i]->data, f2[i]->size);
2680  p1 += f1[i]->size;
2681  p2 += f2[i]->size;
2682  n += f1[i]->size;
2683  found = 1;
2684  break;
2685  }
2686  }
2687  }
2688  if (found) {
2689  found = 0;
2690  continue;
2691  }
2692  ++n;
2693  *p2++ = *p1++;
2694  }
2695  if (unlikely(offset > 0)) {
2696  calc_ref_mod (curr_field, offset, length);
2697  }
2698  cob_free (f1);
2699  cob_free (f2);
2700  return curr_field;
2701 }
COB_EXPIMP cob_field* cob_intr_sum ( const int  ,
  ... 
)

References cob_alloc_field(), cob_decimal_add(), cob_decimal_get_field(), cob_decimal_set_field(), curr_field, params, cob_decimal::scale, and cob_decimal::value.

3939 {
3940  cob_field *f;
3941  va_list args;
3942  int i;
3943 
3944  mpz_set_ui (d1.value, 0UL);
3945  d1.scale = 0;
3946 
3947  va_start (args, params);
3948 
3949  for (i = 0; i < params; ++i) {
3950  f = va_arg (args, cob_field *);
3951  cob_decimal_set_field (&d2, f);
3952  cob_decimal_add (&d1, &d2);
3953  }
3954  va_end (args);
3955 
3956  cob_alloc_field (&d1);
3957  (void)cob_decimal_get_field (&d1, curr_field, 0);
3958  return curr_field;
3959 }
COB_EXPIMP cob_field* cob_intr_test_date_yyyymmdd ( cob_field )

References cob_alloc_set_field_uint(), cob_get_int(), curr_field, leap_month_days, leap_year(), normal_month_days, and valid_year().

3201 {
3202  int indate;
3203  int days;
3204  int month;
3205  int year;
3206 
3207  /* Base 1601-01-01 */
3208  indate = cob_get_int (srcfield);
3209  year = indate / 10000;
3210  if (!valid_year (year)) {
3212  return curr_field;
3213  }
3214  indate %= 10000;
3215  month = indate / 100;
3216  if (month < 1 || month > 12) {
3218  return curr_field;
3219  }
3220  days = indate % 100;
3221  if (days < 1 || days > 31) {
3223  return curr_field;
3224  }
3225  if (leap_year (year)) {
3226  if (days > leap_month_days[month]) {
3228  return curr_field;
3229  }
3230  } else {
3231  if (days > normal_month_days[month]) {
3233  return curr_field;
3234  }
3235  }
3237  return curr_field;
3238 }
COB_EXPIMP cob_field* cob_intr_test_day_yyyyddd ( cob_field )

References cob_alloc_set_field_uint(), cob_get_int(), curr_field, leap_year(), and valid_year().

3242 {
3243  int indate;
3244  int days;
3245  int year;
3246 
3247  /* Base 1601-01-01 */
3248  indate = cob_get_int (srcfield);
3249  year = indate / 1000;
3250  if (!valid_year (year)) {
3252  return curr_field;
3253  }
3254  days = indate % 1000;
3255  if (days < 1 || days > 365 + leap_year (year)) {
3257  return curr_field;
3258  }
3260  return curr_field;
3261 }
COB_EXPIMP cob_field* cob_intr_test_formatted_datetime ( cob_field ,
cob_field  
)

References cob_fatal_error(), COB_FERROR_FUNCTION, and COB_UNUSED.

5815 {
5816  COB_UNUSED (f1);
5817  COB_UNUSED (f2);
5818 
5819  cob_fatal_error (COB_FERROR_FUNCTION);
5820 }
COB_EXPIMP cob_field* cob_intr_test_numval ( cob_field )

References cob_alloc_set_field_int(), cob_check_numval(), curr_field, and NULL.

5246 {
5247  cob_alloc_set_field_int (cob_check_numval (srcfield, NULL, 0, 0));
5248  return curr_field;
5249 }
COB_EXPIMP cob_field* cob_intr_test_numval_c ( cob_field ,
cob_field  
)

References cob_alloc_set_field_int(), cob_check_numval(), and curr_field.

5253 {
5254  cob_alloc_set_field_int (cob_check_numval (srcfield, currency, 1, 0));
5255  return curr_field;
5256 }
COB_EXPIMP cob_field* cob_intr_test_numval_f ( cob_field )

References cob_alloc_set_field_int(), cob_check_numval_f(), and curr_field.

5260 {
5262  return curr_field;
5263 }
COB_EXPIMP cob_field* cob_intr_trim ( const int  ,
const int  ,
cob_field ,
const int   
)

References calc_ref_mod(), curr_field, cob_field::data, make_field_entry(), cob_field::size, and unlikely.

2706 {
2707  unsigned char *begin;
2708  unsigned char *end;
2709  size_t i;
2710  size_t size;
2711 
2712  make_field_entry (srcfield);
2713 
2714  for (i = 0; i < srcfield->size; ++i) {
2715  if (srcfield->data[i] != ' ') {
2716  break;
2717  }
2718  }
2719  if (i == srcfield->size) {
2720  curr_field->size = 0;
2721  curr_field->data[0] = ' ';
2722  return curr_field;
2723  }
2724 
2725  begin = srcfield->data;
2726  if (direction != 2) {
2727  for (; *begin == ' '; ++begin) ;
2728  }
2729  end = srcfield->data + srcfield->size - 1;
2730  if (direction != 1) {
2731  for (; *end == ' '; end--) ;
2732  }
2733 
2734  size = 0;
2735  for (i = 0; begin <= end; ++begin, ++i) {
2736  curr_field->data[i] = *begin;
2737  ++size;
2738  }
2739  curr_field->size = size;
2740  if (unlikely(offset > 0)) {
2741  calc_ref_mod (curr_field, offset, length);
2742  }
2743  return curr_field;
2744 }
COB_EXPIMP cob_field* cob_intr_upper_case ( const int  ,
const int  ,
cob_field  
)

References calc_ref_mod(), cob_u8_t, curr_field, cob_field::data, make_field_entry(), cob_field::size, and unlikely.

2304 {
2305  size_t i, size;
2306 
2307  make_field_entry (srcfield);
2308 
2309  size = srcfield->size;
2310  for (i = 0; i < size; ++i) {
2311  curr_field->data[i] = (cob_u8_t)toupper (srcfield->data[i]);
2312  }
2313  if (unlikely(offset > 0)) {
2314  calc_ref_mod (curr_field, offset, length);
2315  }
2316  return curr_field;
2317 }
COB_EXPIMP cob_field* cob_intr_variance ( const int  ,
  ... 
)

References cob_alloc_field(), cob_alloc_set_field_uint(), cob_decimal_add(), cob_decimal_div(), cob_decimal_get_field(), cob_decimal_mul(), cob_decimal_set_field(), cob_decimal_sub(), cob_uli_t, curr_field, params, cob_decimal::scale, and cob_decimal::value.

4267 {
4268  cob_field *f;
4269  va_list args;
4270  int i;
4271 
4272  va_start (args, params);
4273 
4274  if (params == 1) {
4275  va_end (args);
4277  return curr_field;
4278  }
4279 
4280  /* MEAN for all params */
4281  mpz_set_ui (d1.value, 0UL);
4282  d1.scale = 0;
4283 
4284  for (i = 0; i < params; ++i) {
4285  f = va_arg (args, cob_field *);
4286  cob_decimal_set_field (&d2, f);
4287  cob_decimal_add (&d1, &d2);
4288  }
4289  va_end (args);
4290 
4291  mpz_set_ui (d2.value, (cob_uli_t)params);
4292  d2.scale = 0;
4293  cob_decimal_div (&d1, &d2);
4294 
4295  /* Got the MEAN in d1, iterate again */
4296 
4297  mpz_set_ui (d4.value, 0UL);
4298  d4.scale = 0;
4299 
4300  va_start (args, params);
4301 
4302  for (i = 0; i < params; ++i) {
4303  f = va_arg (args, cob_field *);
4304  cob_decimal_set_field (&d2, f);
4305  cob_decimal_sub (&d2, &d1);
4306  cob_decimal_mul (&d2, &d2);
4307  cob_decimal_add (&d4, &d2);
4308  }
4309  va_end (args);
4310 
4311  mpz_set_ui (d3.value, (cob_uli_t)params);
4312  d3.scale = 0;
4313  cob_decimal_div (&d4, &d3);
4314 
4315  cob_alloc_field (&d4);
4316  (void)cob_decimal_get_field (&d4, curr_field, 0);
4317  return curr_field;
4318 }
COB_EXPIMP cob_field* cob_intr_when_compiled ( const int  ,
const int  ,
cob_field  
)

References calc_ref_mod(), curr_field, cob_field::data, make_field_entry(), cob_field::size, and unlikely.

2857 {
2858  make_field_entry (f);
2859 
2860  memcpy (curr_field->data, f->data, f->size);
2861  if (unlikely(offset > 0)) {
2862  calc_ref_mod (curr_field, offset, length);
2863  }
2864  return curr_field;
2865 }
COB_EXPIMP cob_field* cob_intr_year_to_yyyy ( const int  ,
  ... 
)

References cob_alloc_set_field_int(), cob_alloc_set_field_uint(), COB_EC_ARGUMENT_FUNCTION, cob_get_int(), cob_set_exception(), curr_field, NULL, and valid_year().

4428 {
4429  cob_field *f;
4430  struct tm *timeptr;
4431  va_list args;
4432  time_t t;
4433  int year;
4434  int interval;
4435  int xqtyear;
4436  int maxyear;
4437 
4438  cob_set_exception (0);
4439  va_start (args, params);
4440  f = va_arg (args, cob_field *);
4441  year = cob_get_int (f);
4442  if (params > 1) {
4443  f = va_arg (args, cob_field *);
4444  interval = cob_get_int (f);
4445  } else {
4446  interval = 50;
4447  }
4448  if (params > 2) {
4449  f = va_arg (args, cob_field *);
4450  xqtyear = cob_get_int (f);
4451  } else {
4452  t = time (NULL);
4453  timeptr = localtime (&t);
4454  xqtyear = 1900 + timeptr->tm_year;
4455  }
4456  va_end (args);
4457 
4458  if (year < 0 || year > 99) {
4461  return curr_field;
4462  }
4463  if (!valid_year (xqtyear)) {
4466  return curr_field;
4467  }
4468  maxyear = xqtyear + interval;
4469  if (maxyear < 1700 || maxyear > 9999) {
4472  return curr_field;
4473  }
4474  if (maxyear % 100 >= year) {
4475  year += 100 * (maxyear / 100);
4476  } else {
4477  year += 100 * ((maxyear / 100) - 1);
4478  }
4479  cob_alloc_set_field_int (year);
4480  return curr_field;
4481 }
COB_EXPIMP int cob_is_alpha ( const cob_field )

References cob_field::data, and cob_field::size.

2234 {
2235  size_t i;
2236 
2237  for (i = 0; i < f->size; ++i) {
2238  if (!isalpha (f->data[i]) && f->data[i] != (unsigned char)' ') {
2239  return 0;
2240  }
2241  }
2242  return 1;
2243 }
COB_EXPIMP int cob_is_lower ( const cob_field )

References cob_field::data, and cob_field::size.

2260 {
2261  size_t i;
2262 
2263  for (i = 0; i < f->size; ++i) {
2264  if (!islower (f->data[i]) && f->data[i] != (unsigned char)' ') {
2265  return 0;
2266  }
2267  }
2268  return 1;
2269 }
COB_EXPIMP int cob_is_numeric ( const cob_field )

References cob_check_numdisp(), COB_FIELD_HAVE_SIGN, COB_FIELD_NO_SIGN_NIBBLE, COB_FIELD_TYPE, COB_MODULE_PTR, COB_TYPE_NUMERIC_BINARY, COB_TYPE_NUMERIC_DISPLAY, COB_TYPE_NUMERIC_DOUBLE, COB_TYPE_NUMERIC_FLOAT, COB_TYPE_NUMERIC_FP_DEC128, COB_TYPE_NUMERIC_FP_DEC64, COB_TYPE_NUMERIC_PACKED, cob_field::data, sign, and cob_field::size.

2156 {
2157  size_t i;
2158  union {
2159  float fpf;
2160  double fpd;
2161  } fval;
2162  int sign;
2163 
2164  switch (COB_FIELD_TYPE (f)) {
2166  return 1;
2168  memcpy (&fval.fpf, f->data, sizeof(float));
2169  return !finite ((double)fval.fpf);
2171  memcpy (&fval.fpd, f->data, sizeof(double));
2172  return !finite (fval.fpd);
2174  /* Check digits */
2175  for (i = 0; i < f->size - 1; ++i) {
2176  if ((f->data[i] & 0xF0) > 0x90 ||
2177  (f->data[i] & 0x0F) > 0x09) {
2178  return 0;
2179  }
2180  }
2181  /* Check high nibble of last byte */
2182  if ((f->data[i] & 0xF0) > 0x90) {
2183  return 0;
2184  }
2185 
2186  if (COB_FIELD_NO_SIGN_NIBBLE (f)) {
2187  /* COMP-6 - Check last nibble */
2188  if ((f->data[i] & 0x0F) > 0x09) {
2189  return 0;
2190  }
2191  return 1;
2192  }
2193 
2194  /* Check sign */
2195  sign = f->data[i] & 0x0F;
2196  if (COB_FIELD_HAVE_SIGN (f)) {
2197  if (sign == 0x0C || sign == 0x0D) {
2198  return 1;
2199  }
2200  if (COB_MODULE_PTR->flag_host_sign &&
2201  sign == 0x0F) {
2202  return 1;
2203  }
2204  } else if (sign == 0x0F) {
2205  return 1;
2206  }
2207  return 0;
2209  return cob_check_numdisp (f);
2211 #ifdef WORDS_BIGENDIAN
2212  return (f->data[0] & 0x78U) != 0x78U;
2213 #else
2214  return (f->data[7] & 0x78U) != 0x78U;
2215 #endif
2217 #ifdef WORDS_BIGENDIAN
2218  return (f->data[0] & 0x78U) != 0x78U;
2219 #else
2220  return (f->data[15] & 0x78U) != 0x78U;
2221 #endif
2222  default:
2223  for (i = 0; i < f->size; ++i) {
2224  if (!isdigit (f->data[i])) {
2225  return 0;
2226  }
2227  }
2228  return 1;
2229  }
2230 }
COB_EXPIMP int cob_is_omitted ( const cob_field )

References cob_field::data, and NULL.

2150 {
2151  return f->data == NULL;
2152 }
COB_EXPIMP int cob_is_upper ( const cob_field )

References cob_field::data, and cob_field::size.

2247 {
2248  size_t i;
2249 
2250  for (i = 0; i < f->size; ++i) {
2251  if (!isupper (f->data[i]) && f->data[i] != (unsigned char)' ') {
2252  return 0;
2253  }
2254  }
2255  return 1;
2256 }
COB_EXPIMP void cob_longjmp ( struct cobjmp_buf )

References _, cobjmp_buf::cbj_jmp_buf, cob_fatal_error(), COB_FERROR_INITIALIZED, cob_runtime_error(), cob_stop_run(), and unlikely.

1168 {
1169  if (unlikely(!cobglobptr)) {
1170  cob_fatal_error (COB_FERROR_INITIALIZED);
1171  }
1172  if (unlikely(!jbuf)) {
1173  cob_runtime_error (_("NULL parameter passed to 'cob_longjmp'"));
1174  cob_stop_run (1);
1175  }
1176  if (!cob_jmp_primed) {
1177  cob_runtime_error (_("Call to 'cob_longjmp' with no prior 'cob_setjmp'"));
1178  cob_stop_run (1);
1179  }
1180  cob_jmp_primed = 0;
1181  longjmp (jbuf->cbj_jmp_buf, 1);
1182 }
COB_EXPIMP void* cob_malloc ( const size_t  )

References cob_fatal_error(), COB_FERROR_MEMORY, and unlikely.

1123 {
1124  void *mptr;
1125 
1126  mptr = calloc ((size_t)1, size);
1127  if (unlikely(!mptr)) {
1128  cob_fatal_error (COB_FERROR_MEMORY);
1129  }
1130  return mptr;
1131 }
COB_EXPIMP void cob_module_enter ( cob_module **  ,
cob_global **  ,
const int   
)

References cob_cache_malloc(), __cob_global::cob_call_params, cob_fatal_error(), COB_FERROR_INITIALIZED, cob_init(), cob_initialized, COB_MODULE_PTR, cobglobptr, NULL, and unlikely.

1578 {
1579  /* Check initialized */
1580  if (unlikely(!cob_initialized)) {
1581  if (auto_init) {
1582  cob_init (0, NULL);
1583  } else {
1584  cob_fatal_error (COB_FERROR_INITIALIZED);
1585  }
1586  }
1587 
1588  /* Set global pointer */
1589  *mglobal = cobglobptr;
1590 
1591  /* Check module pointer */
1592  if (!*module) {
1593  *module = cob_cache_malloc (sizeof(cob_module));
1594  }
1595 
1596 #if 0 /* RXWRXW - Params */
1597  /* Save parameter count */
1598  (*module)->module_num_params = cobglobptr->cob_call_params;
1599 #endif
1600 
1601  /* Push module pointer */
1602  (*module)->next = COB_MODULE_PTR;
1603  COB_MODULE_PTR = *module;
1604 }
COB_EXPIMP void cob_module_leave ( cob_module )

References COB_MODULE_PTR, and COB_UNUSED.

1608 {
1609  COB_UNUSED (module);
1610  /* Pop module pointer */
1612 }
COB_EXPIMP void cob_move ( cob_field ,
cob_field  
)

References cob_field::attr, cob_decimal_move_temp(), cob_decimal_setget_fld(), COB_FIELD_BINARY_TRUNC, COB_FIELD_DIGITS, COB_FIELD_REAL_BINARY, COB_FIELD_SCALE, COB_FIELD_TYPE, COB_MAX_DIGITS, cob_max_int(), cob_move_all(), cob_move_alphanum_to_alphanum(), cob_move_alphanum_to_display(), cob_move_alphanum_to_edited(), cob_move_binary_to_binary(), cob_move_binary_to_display(), cob_move_display_to_alphanum(), cob_move_display_to_binary(), cob_move_display_to_display(), cob_move_display_to_edited(), cob_move_display_to_packed(), cob_move_edited_to_display(), cob_move_fp_to_fp(), cob_move_packed_to_display(), COB_STORE_TRUNC_ON_OVERFLOW, COB_TYPE_ALPHANUMERIC_ALL, COB_TYPE_ALPHANUMERIC_EDITED, COB_TYPE_GROUP, COB_TYPE_NUMERIC_BINARY, COB_TYPE_NUMERIC_DISPLAY, COB_TYPE_NUMERIC_DOUBLE, COB_TYPE_NUMERIC_EDITED, COB_TYPE_NUMERIC_FLOAT, COB_TYPE_NUMERIC_FP_BIN128, COB_TYPE_NUMERIC_FP_BIN32, COB_TYPE_NUMERIC_FP_BIN64, COB_TYPE_NUMERIC_FP_DEC128, COB_TYPE_NUMERIC_FP_DEC64, COB_TYPE_NUMERIC_L_DOUBLE, COB_TYPE_NUMERIC_PACKED, const_alpha_attr, cob_field::data, indirect_move(), cob_field::size, and unlikely.

1170 {
1171  int opt;
1172  cob_field temp;
1173  unsigned char data[4];
1174 
1175  if (src == dst) {
1176  return;
1177  }
1178  if (dst->size == 0) {
1179  return;
1180  }
1181  if (unlikely(src->size == 0)) {
1182  temp.size = 1;
1183  temp.data = data;
1184  temp.attr = &const_alpha_attr;
1185  data[0] = ' ';
1186  data[1] = 0;
1187  src = &temp;
1188  }
1189  if (COB_FIELD_TYPE (src) == COB_TYPE_ALPHANUMERIC_ALL) {
1190  cob_move_all (src, dst);
1191  return;
1192  }
1193 
1194  /* Non-elementary move */
1195  if (COB_FIELD_TYPE (src) == COB_TYPE_GROUP ||
1196  COB_FIELD_TYPE (dst) == COB_TYPE_GROUP) {
1197  cob_move_alphanum_to_alphanum (src, dst);
1198  return;
1199  }
1200 
1201  opt = 0;
1202  if (COB_FIELD_TYPE (dst) == COB_TYPE_NUMERIC_BINARY) {
1203  if (COB_FIELD_BINARY_TRUNC (dst) &&
1204  !COB_FIELD_REAL_BINARY(dst)) {
1206  }
1207  }
1208 
1209  /* Elementary move */
1210  switch (COB_FIELD_TYPE (src)) {
1212  switch (COB_FIELD_TYPE (dst)) {
1221  cob_decimal_setget_fld (src, dst, 0);
1222  return;
1224  cob_move_display_to_display (src, dst);
1225  return;
1227  cob_move_display_to_packed (src, dst);
1228  return;
1230  cob_move_display_to_binary (src, dst);
1231  return;
1233  cob_move_display_to_edited (src, dst);
1234  return;
1236  if (COB_FIELD_SCALE(src) < 0 ||
1237  COB_FIELD_SCALE(src) > COB_FIELD_DIGITS(src)) {
1238  /* Expand P's */
1240  (size_t)cob_max_int ((int)COB_FIELD_DIGITS(src), (int)COB_FIELD_SCALE(src)),
1241  cob_max_int (0, (int)COB_FIELD_SCALE(src)));
1242  return;
1243  } else {
1244  cob_move_alphanum_to_edited (src, dst);
1245  return;
1246  }
1247  default:
1248  cob_move_display_to_alphanum (src, dst);
1249  return;
1250  }
1251 
1253  switch (COB_FIELD_TYPE (dst)) {
1255  cob_move_packed_to_display (src, dst);
1256  return;
1258  cob_decimal_setget_fld (src, dst, opt);
1259  return;
1269  cob_decimal_setget_fld (src, dst, 0);
1270  return;
1271  default:
1273  (size_t)(COB_FIELD_DIGITS(src)),
1274  COB_FIELD_SCALE(src));
1275  return;
1276  }
1277 
1279  switch (COB_FIELD_TYPE (dst)) {
1281  if (COB_FIELD_SCALE(src) == COB_FIELD_SCALE(dst)) {
1282  cob_move_binary_to_binary (src, dst);
1283  return;
1284  }
1285  cob_decimal_setget_fld (src, dst, opt);
1286  return;
1288  cob_move_binary_to_display (src, dst);
1289  return;
1299  cob_decimal_setget_fld (src, dst, 0);
1300  return;
1303  (size_t)COB_MAX_DIGITS,
1304  COB_FIELD_SCALE(src));
1305  return;
1306  default:
1308  (size_t)(COB_FIELD_DIGITS(src)),
1309  COB_FIELD_SCALE(src));
1310  return;
1311  }
1312 
1314  switch (COB_FIELD_TYPE (dst)) {
1316  cob_move_edited_to_display (src, dst);
1317  return;
1330  (size_t)(2 * COB_MAX_DIGITS),
1331  COB_MAX_DIGITS);
1332  return;
1334  cob_move_alphanum_to_edited (src, dst);
1335  return;
1336  default:
1337  cob_move_alphanum_to_alphanum (src, dst);
1338  return;
1339  }
1340 
1342  switch (COB_FIELD_TYPE (dst)) {
1344  memmove (dst->data, src->data, sizeof(double));
1345  return;
1347  cob_move_fp_to_fp (src, dst);
1348  return;
1350  cob_decimal_setget_fld (src, dst, opt);
1351  return;
1360  cob_decimal_setget_fld (src, dst, 0);
1361  return;
1362  default:
1363  cob_decimal_move_temp (src, dst);
1364  return;
1365  }
1366 
1368  switch (COB_FIELD_TYPE (dst)) {
1370  memmove (dst->data, src->data, sizeof(float));
1371  return;
1373  cob_move_fp_to_fp (src, dst);
1374  return;
1376  cob_decimal_setget_fld (src, dst, opt);
1377  return;
1386  cob_decimal_setget_fld (src, dst, 0);
1387  return;
1388  default:
1389  cob_decimal_move_temp (src, dst);
1390  return;
1391  }
1392 
1394  switch (COB_FIELD_TYPE (dst)) {
1396  cob_decimal_setget_fld (src, dst, opt);
1397  return;
1399  memmove (dst->data, src->data, (size_t)8);
1400  return;
1409  cob_decimal_setget_fld (src, dst, 0);
1410  return;
1411  default:
1412  cob_decimal_move_temp (src, dst);
1413  return;
1414  }
1416  switch (COB_FIELD_TYPE (dst)) {
1418  cob_decimal_setget_fld (src, dst, opt);
1419  return;
1421  memmove (dst->data, src->data, (size_t)16);
1422  return;
1432  cob_decimal_setget_fld (src, dst, 0);
1433  return;
1434  default:
1435  cob_decimal_move_temp (src, dst);
1436  return;
1437  }
1438  default:
1439  switch (COB_FIELD_TYPE (dst)) {
1441  cob_move_alphanum_to_display (src, dst);
1442  return;
1455  (size_t)(2* COB_MAX_DIGITS),
1456  COB_MAX_DIGITS);
1457  return;
1459  cob_move_alphanum_to_edited (src, dst);
1460  return;
1461  default:
1462  cob_move_alphanum_to_alphanum (src, dst);
1463  return;
1464  }
1465  }
1466 }
COB_EXPIMP void cob_mul ( cob_field ,
cob_field ,
const int   
)

References cob_decimal_get_field(), cob_decimal_mul(), and cob_decimal_set_field().

1950 {
1954  (void)cob_decimal_get_field (&cob_d1, f1, opt);
1955 }
COB_EXPIMP int cob_numeric_cmp ( cob_field ,
cob_field  
)

References cob_cmp_float(), cob_decimal_cmp(), cob_decimal_set_field(), COB_FIELD_TYPE, COB_TYPE_NUMERIC_DOUBLE, and COB_TYPE_NUMERIC_FLOAT.

2345 {
2346  if(COB_FIELD_TYPE (f1) == COB_TYPE_NUMERIC_FLOAT
2347  || COB_FIELD_TYPE (f1) == COB_TYPE_NUMERIC_DOUBLE
2348  || COB_FIELD_TYPE (f2) == COB_TYPE_NUMERIC_FLOAT
2349  || COB_FIELD_TYPE (f2) == COB_TYPE_NUMERIC_DOUBLE) {
2350  return cob_cmp_float(f1,f2);
2351  }
2354  return cob_decimal_cmp (&cob_d1, &cob_d2);
2355 }
COB_EXPIMP void cob_open ( cob_file ,
const int  ,
const int  ,
cob_field  
)

References cob_file::assign, cob_cache_file(), cob_field_to_string(), COB_FILE_MAX, COB_FILE_STDIN, COB_FILE_STDOUT, COB_LOCK_OPEN_EXCLUSIVE, COB_OPEN_CLOSED, COB_OPEN_INPUT, COB_OPEN_LOCKED, COB_OPEN_OUTPUT, COB_STATUS_00_SUCCESS, COB_STATUS_30_PERMANENT_ERROR, COB_STATUS_38_CLOSED_WITH_LOCK, COB_STATUS_41_ALREADY_OPEN, cob_file::fd, cob_file::file, file_open_name, cob_file::flag_begin_of_file, cob_file::flag_end_of_file, cob_file::flag_first_read, cob_file::flag_nonexistent, cob_file::flag_operation, cob_file::flag_read_done, cob_file::last_open_mode, cob_file::lock_mode, cob_fileio_funcs::open, cob_file::open_mode, cob_file::organization, save_status(), and unlikely.

4458 {
4459  f->flag_read_done = 0;
4460 
4461  /* File was previously closed with lock */
4462  if (f->open_mode == COB_OPEN_LOCKED) {
4464  return;
4465  }
4466 
4467  /* File is already open */
4468  if (f->open_mode != COB_OPEN_CLOSED) {
4469  save_status (f, fnstatus, COB_STATUS_41_ALREADY_OPEN);
4470  return;
4471  }
4472 
4473  f->last_open_mode = mode;
4474  f->flag_nonexistent = 0;
4475  f->flag_end_of_file = 0;
4476  f->flag_begin_of_file = 0;
4477  f->flag_first_read = 2;
4478  f->flag_operation = 0;
4479  f->lock_mode &= ~COB_LOCK_OPEN_EXCLUSIVE;
4480  f->lock_mode |= sharing;
4481 
4482  if (unlikely(COB_FILE_STDIN (f))) {
4483  if (mode != COB_OPEN_INPUT) {
4485  return;
4486  }
4487  f->file = stdin;
4488  f->fd = fileno (stdin);
4489  f->open_mode = mode;
4490  save_status (f, fnstatus, COB_STATUS_00_SUCCESS);
4491  return;
4492  }
4493  if (unlikely(COB_FILE_STDOUT (f))) {
4494  if (mode != COB_OPEN_OUTPUT) {
4496  return;
4497  }
4498  f->file = stdout;
4499  f->fd = fileno (stdout);
4500  f->open_mode = mode;
4501  save_status (f, fnstatus, COB_STATUS_00_SUCCESS);
4502  return;
4503  }
4504 
4505  /* Obtain the file name */
4506  cob_field_to_string (f->assign, file_open_name, (size_t)COB_FILE_MAX);
4507 
4508  cob_cache_file (f);
4509 
4510  /* Open the file */
4511  save_status (f, fnstatus,
4512  fileio_funcs[(int)f->organization]->open (f, file_open_name,
4513  mode, sharing));
4514 }
COB_EXPIMP void cob_put_indirect_field ( cob_field )

References curr_field, cob_field::data, make_field_entry(), and cob_field::size.

2060 {
2061  make_field_entry (f);
2062  memcpy (curr_field->data, f->data, f->size);
2064 }
COB_EXPIMP int cob_putenv ( char *  )

References cob_rescan_env_vals(), and cob_strdup().

2855 {
2856  int ret;
2857 
2858  if (name && strchr (name, '=')) {
2859  ret = putenv (cob_strdup(name));
2860  if (!ret) {
2862  }
2863  return ret;
2864  }
2865  return -1;
2866 }
COB_EXPIMP void cob_read ( cob_file ,
cob_field ,
cob_field ,
const int   
)

References COB_OPEN_I_O, COB_OPEN_INPUT, COB_READ_PREVIOUS, cob_set_int(), COB_STATUS_00_SUCCESS, COB_STATUS_02_SUCCESS_DUPLICATE, COB_STATUS_10_END_OF_FILE, COB_STATUS_23_KEY_NOT_EXISTS, COB_STATUS_46_READ_ERROR, COB_STATUS_47_INPUT_DENIED, cob_file::flag_begin_of_file, cob_file::flag_end_of_file, cob_file::flag_first_read, cob_file::flag_nonexistent, cob_file::flag_read_done, NULL, cob_file::open_mode, cob_file::organization, cob_fileio_funcs::read, cob_fileio_funcs::read_next, cob_file::record, save_status(), cob_field::size, unlikely, and cob_file::variable_record.

4653 {
4654  int ret;
4655 
4656  f->flag_read_done = 0;
4657 
4658  if (unlikely(f->open_mode != COB_OPEN_INPUT &&
4659  f->open_mode != COB_OPEN_I_O)) {
4660  save_status (f, fnstatus, COB_STATUS_47_INPUT_DENIED);
4661  return;
4662  }
4663 
4664  if (unlikely(f->flag_nonexistent)) {
4665  if (f->flag_first_read == 0) {
4667  return;
4668  }
4669  f->flag_first_read = 0;
4670  save_status (f, fnstatus, COB_STATUS_10_END_OF_FILE);
4671  return;
4672  }
4673 
4674  /* Sequential read at the end of file is an error */
4675  if (key == NULL) {
4676  if (unlikely(f->flag_end_of_file &&
4677  !(read_opts & COB_READ_PREVIOUS))) {
4678  save_status (f, fnstatus, COB_STATUS_46_READ_ERROR);
4679  return;
4680  }
4681  if (unlikely(f->flag_begin_of_file &&
4682  (read_opts & COB_READ_PREVIOUS))) {
4683  save_status (f, fnstatus, COB_STATUS_46_READ_ERROR);
4684  return;
4685  }
4686  ret = fileio_funcs[(int)f->organization]->read_next (f, read_opts);
4687  } else {
4688  ret = fileio_funcs[(int)f->organization]->read (f, key, read_opts);
4689  }
4690 
4691  switch (ret) {
4692  case COB_STATUS_00_SUCCESS:
4694  f->flag_first_read = 0;
4695  f->flag_read_done = 1;
4696  f->flag_end_of_file = 0;
4697  f->flag_begin_of_file = 0;
4698  if (f->variable_record) {
4699  cob_set_int (f->variable_record, (int) f->record->size);
4700  }
4701  break;
4703  if (read_opts & COB_READ_PREVIOUS) {
4704  f->flag_begin_of_file = 1;
4705  } else {
4706  f->flag_end_of_file = 1;
4707  }
4708  break;
4709  }
4710 
4711  save_status (f, fnstatus, ret);
4712 }
COB_EXPIMP void cob_read_next ( cob_file ,
cob_field ,
const int   
)

References COB_OPEN_I_O, COB_OPEN_INPUT, COB_READ_PREVIOUS, cob_set_int(), COB_STATUS_00_SUCCESS, COB_STATUS_02_SUCCESS_DUPLICATE, COB_STATUS_10_END_OF_FILE, COB_STATUS_23_KEY_NOT_EXISTS, COB_STATUS_46_READ_ERROR, COB_STATUS_47_INPUT_DENIED, cob_file::flag_begin_of_file, cob_file::flag_end_of_file, cob_file::flag_first_read, cob_file::flag_nonexistent, cob_file::flag_read_done, cob_file::open_mode, cob_file::organization, cob_fileio_funcs::read_next, cob_file::record, save_status(), cob_field::size, unlikely, and cob_file::variable_record.

4716 {
4717  int ret;
4718 
4719  f->flag_read_done = 0;
4720 
4721  if (unlikely(f->open_mode != COB_OPEN_INPUT &&
4722  f->open_mode != COB_OPEN_I_O)) {
4723  save_status (f, fnstatus, COB_STATUS_47_INPUT_DENIED);
4724  return;
4725  }
4726 
4727  if (unlikely(f->flag_nonexistent)) {
4728  if (f->flag_first_read == 0) {
4730  return;
4731  }
4732  f->flag_first_read = 0;
4733  save_status (f, fnstatus, COB_STATUS_10_END_OF_FILE);
4734  return;
4735  }
4736 
4737  /* Sequential read at the end of file is an error */
4738  if (unlikely(f->flag_end_of_file && !(read_opts & COB_READ_PREVIOUS))) {
4739  save_status (f, fnstatus, COB_STATUS_46_READ_ERROR);
4740  return;
4741  }
4742  if (unlikely(f->flag_begin_of_file && (read_opts & COB_READ_PREVIOUS))) {
4743  save_status (f, fnstatus, COB_STATUS_46_READ_ERROR);
4744  return;
4745  }
4746 
4747  ret = fileio_funcs[(int)f->organization]->read_next (f, read_opts);
4748 
4749  switch (ret) {
4750  case COB_STATUS_00_SUCCESS:
4752  f->flag_first_read = 0;
4753  f->flag_read_done = 1;
4754  f->flag_end_of_file = 0;
4755  f->flag_begin_of_file = 0;
4756  if (f->variable_record) {
4757  cob_set_int (f->variable_record, (int) f->record->size);
4758  }
4759  break;
4761  if (read_opts & COB_READ_PREVIOUS) {
4762  f->flag_begin_of_file = 1;
4763  } else {
4764  f->flag_end_of_file = 1;
4765  }
4766  break;
4767  }
4768 
4769  save_status (f, fnstatus, ret);
4770 }
COB_EXPIMP void cob_ready_trace ( void  )

References cob_line_trace.

1305 {
1306  cob_line_trace = 1;
1307 }
COB_EXPIMP void cob_reg_sighnd ( void(*)(int)  sighnd)

References cob_ext_sighdl.

2069 {
2070  cob_ext_sighdl = sighnd;
2071 }
COB_EXPIMP void cob_reset_trace ( void  )

References cob_line_trace.

1311 {
1312  cob_line_trace = 0;
1313 }
COB_EXPIMP void* cob_resolve ( const char *  )

References cob_chk_call_path(), cob_free(), cob_resolve_internal(), and p.

916 {
917  void *p;
918  char *entry;
919  char *dirent;
920 
921  entry = cob_chk_call_path (name, &dirent);
922  p = cob_resolve_internal (entry, dirent, 0);
923  if (dirent) {
924  cob_free (dirent);
925  }
926  return p;
927 }
COB_EXPIMP void* cob_resolve_cobol ( const char *  ,
const int  ,
const int   
)

References cob_call_error(), cob_chk_call_path(), cob_free(), cob_resolve_internal(), cob_set_exception(), p, and unlikely.

931 {
932  void *p;
933  char *entry;
934  char *dirent;
935 
936  entry = cob_chk_call_path (name, &dirent);
937  p = cob_resolve_internal (entry, dirent, fold_case);
938  if (dirent) {
939  cob_free (dirent);
940  }
941  if (unlikely(!p)) {
942  if (errind) {
943  cob_call_error ();
944  }
945  cob_set_exception (COB_EC_PROGRAM_NOT_FOUND);
946  }
947  return p;
948 }
COB_EXPIMP const char* cob_resolve_error ( void  )

References _, NULL, p, and resolve_error.

872 {
873  const char *p;
874 
875  if (!resolve_error) {
876  p = _("Indeterminable error");
877  } else {
878  p = resolve_error;
880  }
881  return p;
882 }
COB_EXPIMP void* cob_resolve_func ( const char *  )

References _, cob_resolve_internal(), cob_runtime_error(), cob_stop_run(), NULL, p, and unlikely.

952 {
953  void *p;
954 
955  p = cob_resolve_internal (name, NULL, 0);
956  if (unlikely(!p)) {
957  cob_runtime_error (_("User function '%s' not found"), name);
958  cob_stop_run (1);
959  }
960  return p;
961 }
COB_EXPIMP void cob_restore_func ( struct cob_func_loc )

References __cob_global::cob_call_params, cob_free(), COB_MODULE_PTR, cob_func_loc::data, cob_func_loc::func_params, cob_func_loc::save_call_params, cob_func_loc::save_module, cob_func_loc::save_num_params, and cob_func_loc::save_proc_parms.

1660 {
1661  /* Restore calling environment */
1662  cobglobptr->cob_call_params = fl->save_call_params;
1663 #if 0 /* RXWRXW - MODNEXT */
1664  COB_MODULE_PTR->next = fl->save_module;
1665 #endif
1666  COB_MODULE_PTR->cob_procedure_params = fl->save_proc_parms;
1667  COB_MODULE_PTR->module_num_params = fl->save_num_params;
1668  cob_free (fl->data);
1669  cob_free (fl->func_params);
1670  cob_free (fl);
1671 }
COB_EXPIMP void cob_rewrite ( cob_file ,
cob_field ,
const int  ,
cob_field  
)

References cob_file::access_mode, COB_ACCESS_SEQUENTIAL, cob_get_int(), COB_OPEN_I_O, COB_ORG_SEQUENTIAL, COB_STATUS_43_READ_NOT_DONE, COB_STATUS_44_RECORD_OVERFLOW, COB_STATUS_49_I_O_DENIED, cob_file::flag_read_done, cob_file::open_mode, cob_file::organization, cob_file::record, cob_fileio_funcs::rewrite, save_status(), cob_field::size, unlikely, and cob_file::variable_record.

4813 {
4814  int read_done;
4815 
4816  read_done = f->flag_read_done;
4817  f->flag_read_done = 0;
4818 
4819  if (unlikely(f->open_mode != COB_OPEN_I_O)) {
4820  save_status (f, fnstatus, COB_STATUS_49_I_O_DENIED);
4821  return;
4822  }
4823 
4824  if (f->access_mode == COB_ACCESS_SEQUENTIAL && !read_done) {
4826  return;
4827  }
4828 
4829  if (unlikely(f->organization == COB_ORG_SEQUENTIAL)) {
4830  if (f->record->size != rec->size) {
4832  return;
4833  }
4834 
4835  if (f->variable_record) {
4836  if (f->record->size != (size_t)cob_get_int (f->variable_record)) {
4838  return;
4839  }
4840  }
4841  }
4842 
4843  save_status (f, fnstatus,
4844  fileio_funcs[(int)f->organization]->rewrite (f, opt));
4845 }
COB_EXPIMP void cob_rollback ( void  )

References cob_file_unlock(), file_list::file, and file_list::next.

4883 {
4884  struct file_list *l;
4885 
4886  for (l = file_cache; l; l = l->next) {
4887  if (l->file) {
4888  cob_file_unlock (l->file);
4889  }
4890  }
4891 }
COB_EXPIMP void* cob_save_func ( cob_field **  ,
const int  ,
const int  ,
  ... 
)

References __cob_global::cob_call_params, cob_malloc(), COB_MODULE_PTR, cob_field::data, cob_func_loc::data, cob_func_loc::func_params, params, cob_func_loc::save_call_params, cob_func_loc::save_module, cob_func_loc::save_num_params, cob_func_loc::save_proc_parms, and unlikely.

1617 {
1618  struct cob_func_loc *fl;
1619  va_list args;
1620  int numparams;
1621  int n;
1622 
1623  if (unlikely(params > eparams)) {
1624  numparams = eparams;
1625  } else {
1626  numparams = params;
1627  }
1628 
1629  /* Allocate return field */
1630  *savefld = cob_malloc (sizeof (cob_field));
1631  /* Allocate save area */
1632  fl = cob_malloc (sizeof(struct cob_func_loc));
1633  fl->func_params = cob_malloc (sizeof(void *) * ((size_t)numparams + 1U));
1634  fl->data = cob_malloc (sizeof(void *) * ((size_t)numparams + 1U));
1635 
1636  /* Save values */
1637  fl->save_module = COB_MODULE_PTR->next;
1639  fl->save_proc_parms = COB_MODULE_PTR->cob_procedure_params;
1640  fl->save_num_params = COB_MODULE_PTR->module_num_params;
1641 
1642  /* Set current values */
1643  COB_MODULE_PTR->cob_procedure_params = fl->func_params;
1644  cobglobptr->cob_call_params = numparams;
1645  if (numparams) {
1646  va_start (args, eparams);
1647  for (n = 0; n < numparams; ++n) {
1648  fl->func_params[n] = va_arg (args, cob_field *);
1649  if (fl->func_params[n]) {
1650  fl->data[n] = fl->func_params[n]->data;
1651  }
1652  }
1653  va_end (args);
1654  }
1655  return fl;
1656 }
COB_EXPIMP void* cob_savenv ( struct cobjmp_buf )

References _, cobjmp_buf::cbj_jmp_buf, cob_fatal_error(), COB_FERROR_INITIALIZED, cob_runtime_error(), cob_stop_run(), and unlikely.

1142 {
1143  if (unlikely(!cobglobptr)) {
1144  cob_fatal_error (COB_FERROR_INITIALIZED);
1145  }
1146  if (unlikely(!jbuf)) {
1147  cob_runtime_error (_("NULL parameter passed to 'cob_savenv'"));
1148  cob_stop_run (1);
1149  }
1150  if (cob_jmp_primed) {
1151  cob_runtime_error (_("Multiple call to 'cob_setjmp'"));
1152  cob_stop_run (1);
1153  }
1154  cob_jmp_primed = 1;
1155  return jbuf->cbj_jmp_buf;
1156 }
COB_EXPIMP void* cob_savenv2 ( struct cobjmp_buf ,
const int   
)

References cob_savenv(), and COB_UNUSED.

1160 {
1161  COB_UNUSED (jsize);
1162 
1163  return cob_savenv (jbuf);
1164 }
COB_EXPIMP void cob_screen_accept ( cob_screen ,
cob_field ,
cob_field ,
cob_field  
)

References COB_UNUSED.

1726 {
1727  COB_UNUSED (s);
1728  COB_UNUSED (line);
1729  COB_UNUSED (column);
1730  COB_UNUSED (ftimeout);
1731 }
COB_EXPIMP void cob_screen_display ( cob_screen ,
cob_field ,
cob_field  
)

References COB_UNUSED.

1717 {
1718  COB_UNUSED (s);
1719  COB_UNUSED (line);
1720  COB_UNUSED (column);
1721 }
COB_EXPIMP void cob_screen_line_col ( cob_field ,
const int   
)

References cob_set_int().

1735 {
1736  if (!l_or_c) {
1737  cob_set_int (f, 24);
1738  } else {
1739  cob_set_int (f, 80);
1740  }
1741 }
COB_EXPIMP void cob_set_cancel ( cob_module )

References call_table, cob_call_union::funcvoid, hash(), insert(), call_hash::module, __cob_module::module_entry, __cob_module::module_name, __cob_module::module_path, call_hash::name, call_hash::next, NULL, p, and call_hash::path.

893 {
894  struct call_hash *p;
895 
896 #ifdef COB_ALT_HASH
897  p = call_table;
898 #else
899  p = call_table[hash ((const unsigned char *)(m->module_name))];
900 #endif
901  for (; p; p = p->next) {
902  if (strcmp (m->module_name, p->name) == 0) {
903  p->module = m;
904  /* Set path in program module structure */
905  if (p->path && m->module_path && !*(m->module_path)) {
906  *(m->module_path) = p->path;
907  }
908  return;
909  }
910  }
911  insert (m->module_name, m->module_entry.funcvoid, NULL, m, NULL, 1);
912 }
COB_EXPIMP void cob_set_environment ( const cob_field ,
const cob_field  
)

References cob_display_env_value(), and cob_display_environment().

2678 {
2680  cob_display_env_value (f2);
2681 }
COB_EXPIMP void cob_set_int ( cob_field ,
const int   
)

References cob_field::attr, COB_ATTR_INIT, COB_FLAG_HAVE_SIGN, COB_FLAG_REAL_BINARY, cob_move(), COB_TYPE_NUMERIC_BINARY, cob_field::data, NULL, and cob_field::size.

1612 {
1613  cob_field temp;
1614  cob_field_attr attr;
1615 
1616  COB_ATTR_INIT (COB_TYPE_NUMERIC_BINARY, 9, 0,
1617  COB_FLAG_HAVE_SIGN | COB_FLAG_REAL_BINARY, NULL);
1618  temp.size = 4;
1619  temp.data = (unsigned char *)&n;
1620  temp.attr = &attr;
1621  cob_move (&temp, f);
1622 }
COB_EXPIMP void cob_set_locale ( cob_field ,
const int   
)

References cob_field_to_string(), cob_free(), COB_LC_ALL, COB_LC_CLASS, COB_LC_COLLATE, COB_LC_CTYPE, COB_LC_MESSAGES, COB_LC_MONETARY, COB_LC_NUMERIC, COB_LC_TIME, COB_LC_USER, __cob_global::cob_locale, __cob_global::cob_locale_ctype, __cob_global::cob_locale_orig, cob_malloc(), cob_set_exception(), cob_strdup(), NULL, p, and cob_field::size.

3766 {
3767 #ifdef HAVE_SETLOCALE
3768  char *p;
3769  char *buff;
3770 
3771  p = NULL;
3772  if (locale) {
3773  if (locale->size == 0) {
3774  return;
3775  }
3776  buff = cob_malloc (locale->size + 1U);
3777  cob_field_to_string (locale, buff, locale->size);
3778  } else {
3779  buff = NULL;
3780  }
3781 
3782  switch (category) {
3783  case COB_LC_COLLATE:
3784  p = setlocale (LC_COLLATE, buff);
3785  break;
3786  case COB_LC_CTYPE:
3787  p = setlocale (LC_CTYPE, buff);
3788  break;
3789 #ifdef LC_MESSAGES
3790  case COB_LC_MESSAGES:
3791  p = setlocale (LC_MESSAGES, buff);
3792  break;
3793 #endif
3794  case COB_LC_MONETARY:
3795  p = setlocale (LC_MONETARY, buff);
3796  break;
3797  case COB_LC_NUMERIC:
3798  p = setlocale (LC_NUMERIC, buff);
3799  break;
3800  case COB_LC_TIME:
3801  p = setlocale (LC_TIME, buff);
3802  break;
3803  case COB_LC_ALL:
3804  p = setlocale (LC_ALL, buff);
3805  break;
3806  case COB_LC_USER:
3807  if (cobglobptr->cob_locale_orig) {
3808  p = setlocale (LC_ALL, cobglobptr->cob_locale_orig);
3809  (void)setlocale (LC_NUMERIC, "C");
3810  }
3811  break;
3812  case COB_LC_CLASS:
3814  p = setlocale (LC_CTYPE, cobglobptr->cob_locale_ctype);
3815  }
3816  break;
3817  }
3818  if (buff) {
3819  cob_free (buff);
3820  }
3821  if (!p) {
3822  cob_set_exception (COB_EC_LOCALE_MISSING);
3823  return;
3824  }
3825  p = setlocale (LC_ALL, NULL);
3826  if (p) {
3827  if (cobglobptr->cob_locale) {
3829  }
3831  }
3832 #else
3833  cob_set_exception (COB_EC_LOCALE_MISSING);
3834 #endif
3835 }
COB_EXPIMP void cob_set_location ( const char *  ,
const unsigned  int,
const char *  ,
const char *  ,
const char *   
)

References cob_check_trace_file(), cob_current_paragraph, cob_current_program_id, cob_current_section, cob_last_sfile, cob_line_trace, COB_MODULE_PTR, cob_source_file, cob_source_line, cob_source_statement, and cob_trace_file.

1241 {
1242  const char *s;
1243 
1244  cob_current_program_id = COB_MODULE_PTR->module_name;
1245  cob_source_file = sfile;
1246  cob_source_line = sline;
1247  cob_current_section = csect;
1248  cob_current_paragraph = cpara;
1249  if (cstatement) {
1250  cob_source_statement = cstatement;
1251  }
1252  if (cob_line_trace) {
1253  if (!cob_trace_file) {
1255  }
1256  if (!cob_last_sfile || strcmp (cob_last_sfile, sfile)) {
1257  cob_last_sfile = sfile;
1258  fprintf (cob_trace_file, "Source : '%s'\n", sfile);
1259  }
1260  if (COB_MODULE_PTR->module_name) {
1261  s = COB_MODULE_PTR->module_name;
1262  } else {
1263  s = "Unknown";
1264  }
1265  fprintf (cob_trace_file,
1266  "Program-Id: %-16s Statement: %-21.21s Line: %u\n",
1267  s, cstatement ? (char *)cstatement : "Unknown",
1268  sline);
1269  fflush (cob_trace_file);
1270  }
1271 }
COB_EXPIMP void cob_set_packed_int ( cob_field ,
const int   
)

References COB_FIELD_DIGITS, COB_FIELD_HAVE_SIGN, COB_FIELD_NO_SIGN_NIBBLE, cob_set_packed_zero(), cob_u32_t, cob_field::data, p, packed_bytes, and cob_field::size.

1262 {
1263  unsigned char *p;
1264  size_t sign = 0;
1265  cob_u32_t n;
1266 
1267  if (!val) {
1268  cob_set_packed_zero (f);
1269  return;
1270  }
1271  if (val < 0) {
1272  n = (cob_u32_t)-val;
1273  sign = 1;
1274  } else {
1275  n = (cob_u32_t)val;
1276  }
1277  memset (f->data, 0, f->size);
1278  p = f->data + f->size - 1;
1279  if (!COB_FIELD_NO_SIGN_NIBBLE (f)) {
1280  *p = (n % 10) << 4;
1281  if (!COB_FIELD_HAVE_SIGN (f)) {
1282  *p |= 0x0FU;
1283  } else if (sign) {
1284  *p |= 0x0DU;
1285  } else {
1286  *p |= 0x0CU;
1287  }
1288  n /= 10;
1289  p--;
1290  }
1291  for (; n && p >= f->data; n /= 100, p--) {
1292  *p = packed_bytes[n % 100];
1293  }
1294  if (COB_FIELD_NO_SIGN_NIBBLE (f)) {
1295  if ((COB_FIELD_DIGITS(f) % 2) == 1) {
1296  *(f->data) &= 0x0FU;
1297  }
1298  return;
1299  }
1300  if ((COB_FIELD_DIGITS(f) % 2) == 0) {
1301  *(f->data) &= 0x0FU;
1302  }
1303 }
COB_EXPIMP void cob_set_packed_zero ( cob_field )

References COB_FIELD_HAVE_SIGN, COB_FIELD_NO_SIGN_NIBBLE, cob_field::data, and cob_field::size.

1074 {
1075  memset (f->data, 0, f->size);
1076  if (COB_FIELD_NO_SIGN_NIBBLE (f)) {
1077  return;
1078  }
1079  if (!COB_FIELD_HAVE_SIGN (f)) {
1080  *(f->data + f->size - 1) = 0x0F;
1081  } else {
1082  *(f->data + f->size - 1) = 0x0C;
1083  }
1084 }
COB_EXPIMP void cob_set_switch ( const int  ,
const int   
)

References cob_switch, and COB_SWITCH_MAX.

2086 {
2087  if (n < 0 || n > (COB_SWITCH_MAX - 1)) {
2088  return;
2089  }
2090  if (flag == 0) {
2091  cob_switch[n] = 0;
2092  } else if (flag == 1) {
2093  cob_switch[n] = 1;
2094  }
2095 }
COB_EXPIMP void cob_start ( cob_file ,
const int  ,
cob_field ,
cob_field ,
cob_field  
)

References cob_file::access_mode, COB_ACCESS_RANDOM, cob_get_int(), COB_OPEN_I_O, COB_OPEN_INPUT, COB_STATUS_00_SUCCESS, COB_STATUS_23_KEY_NOT_EXISTS, COB_STATUS_47_INPUT_DENIED, cob_file::flag_begin_of_file, cob_file::flag_end_of_file, cob_file::flag_first_read, cob_file::flag_nonexistent, cob_file::flag_read_done, cob_file::open_mode, cob_file::organization, save_status(), cob_field::size, cob_fileio_funcs::start, and unlikely.

4605 {
4606  int ret;
4607  int size;
4608  cob_field tempkey;
4609 
4610  f->flag_read_done = 0;
4611  f->flag_first_read = 0;
4612 
4613  if (unlikely(f->open_mode != COB_OPEN_I_O &&
4614  f->open_mode != COB_OPEN_INPUT)) {
4615  save_status (f, fnstatus, COB_STATUS_47_INPUT_DENIED);
4616  return;
4617  }
4618 
4619  if (unlikely(f->access_mode == COB_ACCESS_RANDOM)) {
4620  save_status (f, fnstatus, COB_STATUS_47_INPUT_DENIED);
4621  return;
4622  }
4623 
4624  if (f->flag_nonexistent) {
4626  return;
4627  }
4628 
4629  size = 0;
4630  if (unlikely(keysize)) {
4631  size = cob_get_int (keysize);
4632  if (size < 1 || size > (int)key->size) {
4634  return;
4635  }
4636  tempkey = *key;
4637  tempkey.size = (size_t)size;
4638  ret = fileio_funcs[(int)f->organization]->start (f, cond, &tempkey);
4639  } else {
4640  ret = fileio_funcs[(int)f->organization]->start (f, cond, key);
4641  }
4642  if (ret == COB_STATUS_00_SUCCESS) {
4643  f->flag_end_of_file = 0;
4644  f->flag_begin_of_file = 0;
4645  f->flag_first_read = 1;
4646  }
4647 
4648  save_status (f, fnstatus, ret);
4649 }
DECLNORET COB_EXPIMP void cob_stop_run ( const int  )

References cob_initialized, cob_terminate_routines(), exit_hdlrs, exit_handlerlist::next, NULL, and exit_handlerlist::proc.

1367 {
1368  struct exit_handlerlist *h;
1369 
1370  if (!cob_initialized) {
1371  exit (1);
1372  }
1373  if (exit_hdlrs != NULL) {
1374  h = exit_hdlrs;
1375  while (h != NULL) {
1376  h->proc ();
1377  h = h->next;
1378  }
1379  }
1381  exit (status);
1382 }
char* cob_strcat ( char *  ,
char *   
)

References cob_fast_malloc(), cob_free(), cob_strdup(), and strbuff.

3869  {
3870  size_t l;
3871  char *temp1, *temp2;
3872 
3873  l = strlen(str1) + strlen(str2) + 1;
3874 
3875  /*
3876  * If one of the parameter is the buffer itself,
3877  * we copy the buffer before continuing.
3878  */
3879  if (str1 == strbuff) {
3880  temp1 = cob_strdup(str1);
3881  } else {
3882  temp1 = str1;
3883  }
3884  if (str2 == strbuff) {
3885  temp2 = cob_strdup(str2);
3886  } else {
3887  temp2 = str2;
3888  }
3889 
3890  cob_free(strbuff);
3891  strbuff = (char*) cob_fast_malloc(l);
3892 
3893  sprintf(strbuff, "%s%s", temp1, temp2);
3894  return strbuff;
3895 }
COB_EXPIMP void cob_string_append ( cob_field )

References COB_EC_OVERFLOW_STRING, cob_get_exception_code(), cob_set_exception(), cob_field::data, cob_field::size, and string_offset.

441 {
442  size_t src_size;
443  int i;
444  int size;
445 
446  if (cob_get_exception_code ()) {
447  return;
448  }
449 
450  src_size = src->size;
451  if (!src_size) {
452  return;
453  }
454  if (string_dlm) {
455  size = (int)(src_size - string_dlm->size + 1);
456  for (i = 0; i < size; ++i) {
457  if (memcmp (src->data + i, string_dlm->data,
458  string_dlm->size) == 0) {
459  src_size = i;
460  break;
461  }
462  }
463  }
464 
465  if (src_size <= string_dst->size - string_offset) {
466  memcpy (string_dst->data + string_offset, src->data, src_size);
467  string_offset += (int) src_size;
468  } else {
469  size = (int)(string_dst->size - string_offset);
470  memcpy (string_dst->data + string_offset, src->data, (size_t)size);
471  string_offset += size;
473  }
474 }
COB_EXPIMP void cob_string_delimited ( cob_field )

References NULL, and string_dlm_copy.

431 {
432  string_dlm = NULL;
433  if (dlm) {
434  string_dlm_copy = *dlm;
436  }
437 }
COB_EXPIMP void cob_string_finish ( void  )

References cob_set_int(), and string_offset.

478 {
479  if (string_ptr) {
481  }
482 }
COB_EXPIMP void cob_string_init ( cob_field ,
cob_field  
)

References COB_EC_OVERFLOW_STRING, cob_get_int(), cob_set_exception(), NULL, cob_field::size, string_dst_copy, string_offset, and string_ptr_copy.

409 {
410  string_dst_copy = *dst;
412  string_ptr = NULL;
413  if (ptr) {
414  string_ptr_copy = *ptr;
416  }
417  string_offset = 0;
418  cob_set_exception (0);
419 
420  if (string_ptr) {
422  if (string_offset < 0 ||
423  string_offset >= (int)string_dst->size) {
425  }
426  }
427 }
char* cob_strjoin ( char **  ,
int  ,
char *   
)

References cob_strcat(), and NULL.

3898  {
3899 
3900  char* result;
3901  int i;
3902 
3903  if(!strarray || size <= 0 || !separator) return NULL;
3904 
3905  result = strarray[0];
3906  for (i = 1; i < size; i++) {
3907  result = cob_strcat(result, separator);
3908  result = cob_strcat(result, strarray[i]);
3909  }
3910 
3911  return result;
3912 }
COB_EXPIMP void cob_sub ( cob_field ,
cob_field ,
const int   
)

References cob_decimal_get_field(), cob_decimal_set_field(), and cob_decimal_sub().

1941 {
1945  (void)cob_decimal_get_field (&cob_d1, f1, opt);
1946 }
COB_EXPIMP int cob_sub_int ( cob_field ,
const int  ,
const int   
)

References cob_add_int().

2252 {
2253  return cob_add_int (f, -n, opt);
2254 }
COB_EXPIMP cob_field* cob_switch_value ( const int  )

References cob_alloc_set_field_int(), cob_get_switch(), and curr_field.

1952 {
1954  return curr_field;
1955 }
COB_EXPIMP int cob_sys_and ( const void *  ,
void *  ,
const int   
)

References COB_CHK_PARMS, and cob_u8_ptr.

3125 {
3126  const cob_u8_ptr data_1 = p1;
3127  cob_u8_ptr data_2 = p2;
3128  size_t n;
3129 
3130  COB_CHK_PARMS (CBL_AND, 3);
3131 
3132  if (length <= 0) {
3133  return 0;
3134  }
3135  for (n = 0; n < (size_t)length; ++n) {
3136  data_2[n] &= data_1[n];
3137  }
3138  return 0;
3139 }
COB_EXPIMP int cob_sys_calledby ( void *  )

References COB_CHK_PARMS, and COB_MODULE_PTR.

3444 {
3445  size_t size;
3446  size_t msize;
3447 
3448  COB_CHK_PARMS (C$CALLEDBY, 1);
3449 
3450  if (!COB_MODULE_PTR->cob_procedure_params[0]) {
3451  return -1;
3452  }
3453  size = COB_MODULE_PTR->cob_procedure_params[0]->size;
3454  memset (data, ' ', size);
3455  if (!COB_MODULE_PTR->next) {
3456  return 0;
3457  }
3458  msize = strlen (COB_MODULE_PTR->next->module_name);
3459  if (msize > size) {
3460  msize = size;
3461  }
3462  memcpy (data, COB_MODULE_PTR->next->module_name, msize);
3463  return 1;
3464 }
COB_EXPIMP int cob_sys_change_dir ( unsigned char *  )

References COB_CHK_PARMS, cob_free(), COB_MODULE_PTR, cob_str_from_fld(), and COB_UNUSED.

5415 {
5416  char *fn;
5417  int ret;
5418 
5419  COB_UNUSED (dir);
5420 
5421  COB_CHK_PARMS (CBL_CHANGE_DIR, 1);
5422 
5423  if (!COB_MODULE_PTR->cob_procedure_params[0]) {
5424  return -1;
5425  }
5426  fn = cob_str_from_fld (COB_MODULE_PTR->cob_procedure_params[0]);
5427  ret = chdir (fn);
5428  cob_free (fn);
5429  if (ret) {
5430  return 128;
5431  }
5432  return 0;
5433 }
COB_EXPIMP int cob_sys_chdir ( unsigned char *  ,
unsigned char *   
)

References COB_CHK_PARMS, COB_MODULE_PTR, cob_set_int(), cob_sys_change_dir(), and COB_UNUSED.

5473 {
5474  int ret;
5475 
5476  COB_UNUSED (status);
5477 
5478  COB_CHK_PARMS (C$CHDIR, 2);
5479 
5480  ret = cob_sys_change_dir (dir);
5481  if (ret < 0) {
5482  ret = 128;
5483  }
5484  cob_set_int (COB_MODULE_PTR->cob_procedure_params[1], ret);
5485  return ret;
5486 }
COB_EXPIMP int cob_sys_check_file_exist ( unsigned char *  ,
unsigned char *   
)

References _, COB_BSWAP_16, COB_BSWAP_64, COB_CHK_PARMS, cob_free(), COB_MODULE_PTR, cob_runtime_error(), cob_s64_t, cob_stop_run(), cob_str_from_fld(), and COB_UNUSED.

5259 {
5260  char *fn;
5261  struct tm *tm;
5262  cob_s64_t sz;
5263  struct stat st;
5264  short y;
5265  short d, m, hh, mm, ss;
5266 
5267  COB_UNUSED (file_name);
5268 
5269  COB_CHK_PARMS (CBL_CHECK_FILE_EXIST, 2);
5270 
5271  if (!COB_MODULE_PTR->cob_procedure_params[0]) {
5272  return -1;
5273  }
5274  if (!COB_MODULE_PTR->cob_procedure_params[1]) {
5275  return -1;
5276  }
5277  if (COB_MODULE_PTR->cob_procedure_params[1]->size < 16U) {
5278  cob_runtime_error (_("'CBL_CHECK_FILE_EXIST' - File detail area is too short"));
5279  cob_stop_run (1);
5280  }
5281 
5282  fn = cob_str_from_fld (COB_MODULE_PTR->cob_procedure_params[0]);
5283  if (stat (fn, &st) < 0) {
5284  cob_free (fn);
5285  return 35;
5286  }
5287  cob_free (fn);
5288  sz = (cob_s64_t)st.st_size;
5289  tm = localtime (&st.st_mtime);
5290  d = (short)tm->tm_mday;
5291  m = (short)(tm->tm_mon + 1);
5292  y = (short)(tm->tm_year + 1900);
5293  hh = (short)tm->tm_hour;
5294  mm = (short)tm->tm_min;
5295  /* Leap seconds ? */
5296  if (tm->tm_sec >= 60) {
5297  ss = 59;
5298  } else {
5299  ss = (short)tm->tm_sec;
5300  }
5301 
5302 #ifndef WORDS_BIGENDIAN
5303  sz = COB_BSWAP_64 (sz);
5304  y = COB_BSWAP_16 (y);
5305 #endif
5306  memcpy (file_info, &sz, (size_t)8);
5307  file_info[8] = (unsigned char)d;
5308  file_info[9] = (unsigned char)m;
5309  memcpy (file_info+10, &y, (size_t)2);
5310  file_info[12] = (unsigned char)hh;
5311  file_info[13] = (unsigned char)mm;
5312  file_info[14] = (unsigned char)ss;
5313  file_info[15] = 0;
5314  return 0;
5315 }
COB_EXPIMP int cob_sys_clear_screen ( void  )
1751 {
1752  return 0;
1753 }
COB_EXPIMP int cob_sys_close_file ( unsigned char *  )

References COB_CHK_PARMS.

5164 {
5165  int fd;
5166 
5167  COB_CHK_PARMS (CBL_CLOSE_FILE, 1);
5168 
5169  memcpy (&fd, file_handle, (size_t)4);
5170  return close (fd);
5171 }
COB_EXPIMP int cob_sys_copy_file ( unsigned char *  ,
unsigned char *   
)

References COB_CHK_PARMS, COB_FILE_BUFF, cob_free(), COB_MODULE_PTR, cob_str_from_fld(), COB_UNUSED, file_open_buff, and O_BINARY.

5207 {
5208  char *fn1;
5209  char *fn2;
5210  int flag = O_BINARY;
5211  int ret;
5212  int i;
5213  int fd1, fd2;
5214 
5215  COB_UNUSED (fname1);
5216  COB_UNUSED (fname2);
5217 
5218  COB_CHK_PARMS (CBL_COPY_FILE, 2);
5219 
5220  if (!COB_MODULE_PTR->cob_procedure_params[0]) {
5221  return -1;
5222  }
5223  if (!COB_MODULE_PTR->cob_procedure_params[1]) {
5224  return -1;
5225  }
5226  fn1 = cob_str_from_fld (COB_MODULE_PTR->cob_procedure_params[0]);
5227  flag |= O_RDONLY;
5228  fd1 = open (fn1, flag, 0);
5229  if (fd1 < 0) {
5230  cob_free (fn1);
5231  return -1;
5232  }
5233  cob_free (fn1);
5234  fn2 = cob_str_from_fld (COB_MODULE_PTR->cob_procedure_params[1]);
5235  flag &= ~O_RDONLY;
5236  flag |= O_CREAT | O_TRUNC | O_WRONLY;
5237  fd2 = open (fn2, flag, 0660);
5238  if (fd2 < 0) {
5239  close (fd1);
5240  cob_free (fn2);
5241  return -1;
5242  }
5243  cob_free (fn2);
5244 
5245  ret = 0;
5246  while ((i = read (fd1, file_open_buff, COB_FILE_BUFF)) > 0) {
5247  if (write (fd2, file_open_buff, (size_t)i) < 0) {
5248  ret = -1;
5249  break;
5250  }
5251  }
5252  close (fd1);
5253  close (fd2);
5254  return ret;
5255 }
COB_EXPIMP int cob_sys_copyfile ( unsigned char *  ,
unsigned char *  ,
unsigned char *   
)

References __cob_global::cob_call_params, COB_CHK_PARMS, cob_sys_copy_file(), and COB_UNUSED.

5491 {
5492  int ret;
5493 
5494  /* RXW - Type is not yet evaluated */
5495  COB_UNUSED (file_type);
5496 
5497  COB_CHK_PARMS (C$COPY, 3);
5498 
5499  if (cobglobptr->cob_call_params < 3) {
5500  return 128;
5501  }
5502  ret = cob_sys_copy_file (fname1, fname2);
5503  if (ret < 0) {
5504  ret = 128;
5505  }
5506  return ret;
5507 }
COB_EXPIMP int cob_sys_create_dir ( unsigned char *  )

References COB_CHK_PARMS, cob_free(), COB_MODULE_PTR, cob_str_from_fld(), and COB_UNUSED.

5389 {
5390  char *fn;
5391  int ret;
5392 
5393  COB_UNUSED (dir);
5394 
5395  COB_CHK_PARMS (CBL_CREATE_DIR, 1);
5396 
5397  if (!COB_MODULE_PTR->cob_procedure_params[0]) {
5398  return -1;
5399  }
5400  fn = cob_str_from_fld (COB_MODULE_PTR->cob_procedure_params[0]);
5401 #ifdef _WIN32
5402  ret = mkdir (fn);
5403 #else
5404  ret = mkdir (fn, 0770);
5405 #endif
5406  cob_free (fn);
5407  if (ret) {
5408  return 128;
5409  }
5410  return 0;
5411 }
COB_EXPIMP int cob_sys_create_file ( unsigned char *  ,
unsigned char *  ,
unsigned char *  ,
unsigned char *  ,
unsigned char *   
)

References _, COB_CHK_PARMS, __cob_global::cob_display_warn, and open_cbl_file().

5061 {
5062  /*
5063  * @param: file_access : 1 (read-only), 2 (write-only), 3 (both)
5064  * @param: file_lock : not implemented, set 0
5065  * @param: file_dev : not implemented, set 0
5066  */
5067 
5068  if (*file_lock != 0 && cobglobptr->cob_display_warn) {
5069  fprintf (stderr, _("WARNING - Call to CBL_CREATE_FILE with wrong file_lock: %d"), *file_lock);
5070  putc ('\n', stderr);
5071  fflush (stderr);
5072  }
5073  if (*file_dev != 0 && cobglobptr->cob_display_warn) {
5074  fprintf (stderr, _("WARNING - Call to CBL_CREATE_FILE with wrong file_dev: %d"), *file_dev);
5075  putc ('\n', stderr);
5076  fflush (stderr);
5077  }
5078 
5079  COB_CHK_PARMS (CBL_CREATE_FILE, 5);
5080 
5081  return open_cbl_file (file_name, file_access, file_handle, O_CREAT | O_TRUNC);
5082 }
COB_EXPIMP int cob_sys_delete_dir ( unsigned char *  )

References COB_CHK_PARMS, cob_free(), COB_MODULE_PTR, cob_str_from_fld(), and COB_UNUSED.

5437 {
5438  char *fn;
5439  int ret;
5440 
5441  COB_UNUSED (dir);
5442 
5443  COB_CHK_PARMS (CBL_DELETE_DIR, 1);
5444 
5445  if (!COB_MODULE_PTR->cob_procedure_params[0]) {
5446  return -1;
5447  }
5448  fn = cob_str_from_fld (COB_MODULE_PTR->cob_procedure_params[0]);
5449  ret = rmdir (fn);
5450  cob_free (fn);
5451  if (ret) {
5452  return 128;
5453  }
5454  return 0;
5455 }
COB_EXPIMP int cob_sys_delete_file ( unsigned char *  )

References COB_CHK_PARMS, cob_free(), COB_MODULE_PTR, cob_str_from_fld(), and COB_UNUSED.

5185 {
5186  char *fn;
5187  int ret;
5188 
5189  COB_UNUSED (file_name);
5190 
5191  COB_CHK_PARMS (CBL_DELETE_FILE, 1);
5192 
5193  if (!COB_MODULE_PTR->cob_procedure_params[0]) {
5194  return -1;
5195  }
5196  fn = cob_str_from_fld (COB_MODULE_PTR->cob_procedure_params[0]);
5197  ret = unlink (fn);
5198  cob_free (fn);
5199  if (ret) {
5200  return 128;
5201  }
5202  return 0;
5203 }
COB_EXPIMP int cob_sys_eq ( const void *  ,
void *  ,
const int   
)

References COB_CHK_PARMS, and cob_u8_ptr.

3233 {
3234  const cob_u8_ptr data_1 = p1;
3235  cob_u8_ptr data_2 = p2;
3236  size_t n;
3237 
3238  COB_CHK_PARMS (CBL_EQ, 3);
3239 
3240  if (length <= 0) {
3241  return 0;
3242  }
3243  for (n = 0; n < (size_t)length; ++n) {
3244  data_2[n] = ~(data_1[n] ^ data_2[n]);
3245  }
3246  return 0;
3247 }
COB_EXPIMP int cob_sys_error_proc ( const void *  ,
const void *   
)

References COB_CHK_PARMS, cob_free(), cob_malloc(), hdlrs, handlerlist::next, NULL, p, and handlerlist::proc.

3041 {
3042  struct handlerlist *hp = NULL;
3043  struct handlerlist *h = hdlrs;
3044  const unsigned char *x;
3045  int (**p)(char *s);
3046 
3047  COB_CHK_PARMS (CBL_ERROR_PROC, 2);
3048 
3049  memcpy (&p, &pptr, sizeof (void *));
3050  if (!p || !*p) {
3051  return -1;
3052  }
3053 
3054  hp = NULL;
3055  h = hdlrs;
3056  /* Remove handler anyway */
3057  while (h != NULL) {
3058  if (h->proc == *p) {
3059  if (hp != NULL) {
3060  hp->next = h->next;
3061  } else {
3062  hdlrs = h->next;
3063  }
3064  if (hp) {
3065  cob_free (hp);
3066  }
3067  break;
3068  }
3069  hp = h;
3070  h = h->next;
3071  }
3072  x = dispo;
3073  if (*x != 0) {
3074  /* Remove handler */
3075  return 0;
3076  }
3077  h = cob_malloc (sizeof(struct handlerlist));
3078  h->next = hdlrs;
3079  h->proc = *p;
3080  hdlrs = h;
3081  return 0;
3082 }
COB_EXPIMP int cob_sys_exit_proc ( const void *  ,
const void *   
)

References COB_CHK_PARMS, cob_free(), cob_malloc(), exit_hdlrs, exit_handlerlist::next, NULL, p, and exit_handlerlist::proc.

2996 {
2997  struct exit_handlerlist *hp;
2998  struct exit_handlerlist *h;
2999  const unsigned char *x;
3000  int (**p)(void);
3001 
3002  COB_CHK_PARMS (CBL_EXIT_PROC, 2);
3003 
3004  memcpy (&p, &pptr, sizeof (void *));
3005  if (!p || !*p) {
3006  return -1;
3007  }
3008 
3009  hp = NULL;
3010  h = exit_hdlrs;
3011  /* Remove handler anyway */
3012  while (h != NULL) {
3013  if (h->proc == *p) {
3014  if (hp != NULL) {
3015  hp->next = h->next;
3016  } else {
3017  exit_hdlrs = h->next;
3018  }
3019  if (hp) {
3020  cob_free (hp);
3021  }
3022  break;
3023  }
3024  hp = h;
3025  h = h->next;
3026  }
3027  x = dispo;
3028  if (*x != 0 && *x != 2 && *x != 3) {
3029  /* Remove handler */
3030  return 0;
3031  }
3032  h = cob_malloc (sizeof(struct exit_handlerlist));
3033  h->next = exit_hdlrs;
3034  h->proc = *p;
3035  exit_hdlrs = h;
3036  return 0;
3037 }
COB_EXPIMP int cob_sys_file_delete ( unsigned char *  ,
unsigned char *   
)

References __cob_global::cob_call_params, COB_CHK_PARMS, COB_MODULE_PTR, cob_sys_delete_file(), and COB_UNUSED.

5575 {
5576  int ret;
5577 
5578  /* RXW - Type is not yet evaluated */
5579  COB_UNUSED (file_type);
5580 
5581  COB_CHK_PARMS (C$DELETE, 2);
5582 
5583  if (cobglobptr->cob_call_params < 2 ||
5584  !COB_MODULE_PTR->cob_procedure_params[0]) {
5585  return 128;
5586  }
5587  ret = cob_sys_delete_file (file_name);
5588  if (ret < 0) {
5589  ret = 128;
5590  }
5591  return ret;
5592 }
COB_EXPIMP int cob_sys_file_info ( unsigned char *  ,
unsigned char *   
)

References _, COB_BSWAP_32, COB_BSWAP_64, __cob_global::cob_call_params, COB_CHK_PARMS, cob_free(), COB_MODULE_PTR, cob_runtime_error(), cob_stop_run(), cob_str_from_fld(), cob_u64_t, and COB_UNUSED.

5511 {
5512  char *fn;
5513  struct tm *tm;
5514  cob_u64_t sz;
5515  unsigned int dt;
5516  short y;
5517  short d, m, hh, mm, ss;
5518  struct stat st;
5519 
5520  COB_UNUSED (file_name);
5521 
5522  COB_CHK_PARMS (C$FILEINFO, 2);
5523 
5524  if (cobglobptr->cob_call_params < 2 ||
5525  !COB_MODULE_PTR->cob_procedure_params[0]) {
5526  return 128;
5527  }
5528  if (!COB_MODULE_PTR->cob_procedure_params[1]) {
5529  return 128;
5530  }
5531  if (COB_MODULE_PTR->cob_procedure_params[1]->size < 16U) {
5532  cob_runtime_error (_("'C$FILEINFO' - File detail area is too short"));
5533  cob_stop_run (1);
5534  }
5535 
5536  fn = cob_str_from_fld (COB_MODULE_PTR->cob_procedure_params[0]);
5537  if (stat (fn, &st) < 0) {
5538  cob_free (fn);
5539  return 35;
5540  }
5541  cob_free (fn);
5542  sz = (cob_u64_t)st.st_size;
5543  tm = localtime (&st.st_mtime);
5544  d = (short)tm->tm_mday;
5545  m = (short)(tm->tm_mon + 1);
5546  y = (short)(tm->tm_year + 1900);
5547  hh = (short)tm->tm_hour;
5548  mm = (short)tm->tm_min;
5549  /* Leap seconds ? */
5550  if (tm->tm_sec >= 60) {
5551  ss = 59;
5552  } else {
5553  ss = (short)tm->tm_sec;
5554  }
5555 
5556 #ifndef WORDS_BIGENDIAN
5557  sz = COB_BSWAP_64 (sz);
5558 #endif
5559  memcpy (file_info, &sz, (size_t)8);
5560  dt = (y * 10000) + (m * 100) + d;
5561 #ifndef WORDS_BIGENDIAN
5562  dt = COB_BSWAP_32 (dt);
5563 #endif
5564  memcpy (file_info + 8, &dt, (size_t)4);
5565  dt = (hh * 1000000) + (mm * 10000) + (ss * 100);
5566 #ifndef WORDS_BIGENDIAN
5567  dt = COB_BSWAP_32 (dt);
5568 #endif
5569  memcpy (file_info + 12, &dt, (size_t)4);
5570  return 0;
5571 }
COB_EXPIMP int cob_sys_flush_file ( unsigned char *  )

References COB_CHK_PARMS, and COB_UNUSED.

5175 {
5176  COB_UNUSED (file_handle);
5177 
5178  COB_CHK_PARMS (CBL_FLUSH_FILE, 1);
5179 
5180  return 0;
5181 }
COB_EXPIMP int cob_sys_get_csr_pos ( unsigned char *  )

References COB_CHK_PARMS.

1783 {
1784 #ifdef COB_GEN_SCREENIO
1785  int cline;
1786  int ccol;
1787 #endif
1788 
1789  COB_CHK_PARMS (CBL_GET_CSR_POS, 1);
1790 
1791 #ifdef COB_GEN_SCREENIO
1792  getyx (stdscr, cline, ccol);
1793  fld[0] = (unsigned char)cline;
1794  fld[1] = (unsigned char)ccol;
1795 
1796 #else
1797  fld[0] = 1U;
1798  fld[1] = 1U;
1799 #endif
1800  return 0;
1801 }
COB_EXPIMP int cob_sys_get_current_dir ( const int  ,
const int  ,
unsigned char *   
)

References COB_CHK_PARMS, cob_free(), and NULL.

5349 {
5350  char *dirname;
5351  int dir_size;
5352  int has_space;
5353 
5354  COB_CHK_PARMS (CBL_GET_CURRENT_DIR, 3);
5355 
5356  if (dir_length < 1) {
5357  return 128;
5358  }
5359  if (flags) {
5360  return 129;
5361  }
5362  memset (dir, ' ', (size_t)dir_length);
5363  dirname = getcwd (NULL, (size_t)0);
5364  if (dirname == NULL) {
5365  return 128;
5366  }
5367  dir_size = (int) strlen (dirname);
5368  has_space = 0;
5369  if (strchr (dirname, ' ')) {
5370  has_space = 2;
5371  }
5372  if (dir_size + has_space > dir_length) {
5373  cob_free (dirname);
5374  return 128;
5375  }
5376  if (has_space) {
5377  *dir = '"';
5378  memcpy (&dir[1], dirname, (size_t)dir_size);
5379  dir[dir_size + 1] = '"';
5380  } else {
5381  memcpy (dir, dirname, (size_t)dir_size);
5382  }
5383  cob_free (dirname);
5384  return 0;
5385 }
COB_EXPIMP int cob_sys_get_scr_size ( unsigned char *  ,
unsigned char *   
)

References COB_CHK_PARMS, COLS, and LINES.

1805 {
1806  COB_CHK_PARMS (CBL_GET_SCR_SIZE, 2);
1807 
1808 #ifdef COB_GEN_SCREENIO
1809  *line = (unsigned char)LINES;
1810  *col = (unsigned char)COLS;
1811 #else
1812  *line = 24U;
1813  *col = 80U;
1814 #endif
1815  return 0;
1816 }
COB_EXPIMP int cob_sys_getopt_long_long ( void *  ,
void *  ,
void *  ,
const int  ,
void *  ,
void *   
)

References _, cob_argc, cob_argv, COB_CHK_PARMS, cob_field_to_string(), cob_free(), cob_get_int(), cob_getopt_long_long(), cob_malloc(), COB_MODULE_PTR, cob_optarg, cob_runtime_error(), cob_set_int(), cob_stop_run(), COB_UNUSED, option::flag, option::has_arg, longoption_def::has_option, option::name, longoption_def::name, NULL, longoption_def::return_value, longoption_def::return_value_pointer, and option::val.

3489  {
3490  /*
3491  * cob_argc is a static int containing argc from runtime
3492  * cob_argv is a static char** containing argv from runtime
3493  */
3494 
3495  size_t opt_val_size = 0;
3496  size_t so_size = 0;
3497  size_t lo_size = 0;
3498 
3499  unsigned int lo_amount;
3500 
3501  int exit_status;
3502 
3503  char* shortoptions;
3504  char* temp;
3505 
3506  struct option* longoptions;
3507  longoption_def* l = NULL;
3508 
3509  int longind = 0;
3510  unsigned int i;
3511  int j;
3512 
3513  unsigned int optlen;
3514  int return_value;
3515 
3516  COB_UNUSED (idx);
3517  COB_UNUSED (lo);
3518  COB_UNUSED (so);
3519 
3520  COB_CHK_PARMS (CBL_OC_GETOPT, 6);
3521 
3522  /*
3523  * Read in sizes of some parameters
3524  */
3525  if (COB_MODULE_PTR->cob_procedure_params[1]) {
3526  lo_size = COB_MODULE_PTR->cob_procedure_params[1]->size;
3527  }
3528  if (COB_MODULE_PTR->cob_procedure_params[0]) {
3529  so_size = COB_MODULE_PTR->cob_procedure_params[0]->size;
3530  }
3531  if (COB_MODULE_PTR->cob_procedure_params[5]) {
3532  opt_val_size = COB_MODULE_PTR->cob_procedure_params[5]->size;
3533  }
3534 
3535  /*
3536  * Buffering longoptions (cobol), target format (struct option)
3537  */
3538  if (lo_size % sizeof(longoption_def) == 0) {
3539  lo_amount = (int)lo_size / sizeof(longoption_def);
3540  longoptions = (struct option*) cob_malloc(sizeof(struct option) * (lo_amount + 1U));
3541  }
3542  else {
3543  cob_runtime_error (_("Call to CBL_OC_GETOPT with wrong longoption size."));
3544  cob_stop_run (1);
3545  }
3546 
3547  if (!COB_MODULE_PTR->cob_procedure_params[2]) {
3548  cob_runtime_error (_("Call to CBL_OC_GETOPT with missing longind."));
3549  cob_stop_run (1);
3550  }
3551  longind = cob_get_int (COB_MODULE_PTR->cob_procedure_params[2]);
3552 
3553  /*
3554  * Add 0-termination to strings.
3555  */
3556  shortoptions = cob_malloc(so_size + 1U);
3557  if (COB_MODULE_PTR->cob_procedure_params[0]) {
3558  cob_field_to_string (COB_MODULE_PTR->cob_procedure_params[0], shortoptions, so_size);
3559  }
3560 
3561  if (COB_MODULE_PTR->cob_procedure_params[1]) {
3562  l = (struct longoption_def*) (COB_MODULE_PTR->cob_procedure_params[1]->data);
3563  }
3564 
3565  for (i = 0; i < lo_amount; i++) {
3566  j = sizeof(l->name) - 1;
3567  while (j >= 0 && l->name[j] == 0x20) {
3568  l->name[j] = 0x00;
3569  j--;
3570  }
3571  longoptions->name = l->name;
3572  longoptions->has_arg = (int) l->has_option - '0';
3573  memcpy (&longoptions->flag, l->return_value_pointer, sizeof(l->return_value_pointer));
3574  memcpy(&longoptions->val, &l->return_value, 4);
3575 
3576  l = l + 1; /* +1 means pointer + 1*sizeof(longoption_def) */
3577  longoptions = longoptions + 1;
3578  }
3579 
3580  /*
3581  * Appending final record, so getopt can spot the end of longoptions
3582  */
3583  longoptions->name = NULL;
3584  longoptions->has_arg = 0;
3585  longoptions->flag = NULL;
3586  longoptions->val = 0;
3587 
3588 
3589  l -= lo_amount; /* Set pointer back to begin of longoptions */
3590  longoptions -= lo_amount;
3591 
3592  return_value = cob_getopt_long_long(cob_argc, cob_argv, shortoptions, longoptions, &longind, long_only);
3593  temp = (char*) &return_value;
3594 
3595  /*
3596  * Write data back to Cobol
3597  */
3598  if (temp[0] == '?' || temp[0] == ':' || temp[0] == 'W'
3599  || temp[0] == -1 || temp[0] == 0) exit_status = return_value;
3600  else exit_status = 3;
3601 
3602  for(i = 3; i > 0; i--) {
3603  if(temp[i] == 0x00) temp[i] = 0x20;
3604  else break;
3605  }
3606 
3607  cob_set_int (COB_MODULE_PTR->cob_procedure_params[2], longind);
3608  memcpy (return_char, &return_value, 4);
3609 
3610  if(cob_optarg != NULL) {
3611  memset (opt_val, 0x00, opt_val_size);
3612 
3613  optlen = strlen (cob_optarg);
3614  if (optlen > opt_val_size) {
3615  /* Returncode 2 for "Optionvalue too long => cut" */
3616  optlen = opt_val_size;
3617  exit_status = 2;
3618  }
3619  memcpy (opt_val, cob_optarg, optlen);
3620  }
3621 
3622 
3623  cob_free (shortoptions);
3624  cob_free (longoptions);
3625 
3626  return exit_status;
3627 
3628 }
COB_EXPIMP int cob_sys_getpid ( void  )

References cob_process_id.

3421 {
3422  if (!cob_process_id) {
3423  cob_process_id = (int)getpid ();
3424  }
3425  return cob_process_id;
3426 }
COB_EXPIMP int cob_sys_imp ( const void *  ,
void *  ,
const int   
)

References COB_CHK_PARMS, and cob_u8_ptr.

3197 {
3198  const cob_u8_ptr data_1 = p1;
3199  cob_u8_ptr data_2 = p2;
3200  size_t n;
3201 
3202  COB_CHK_PARMS (CBL_IMP, 3);
3203 
3204  if (length <= 0) {
3205  return 0;
3206  }
3207  for (n = 0; n < (size_t)length; ++n) {
3208  data_2[n] = (~data_1[n]) | data_2[n];
3209  }
3210  return 0;
3211 }
COB_EXPIMP int cob_sys_justify ( void *  ,
  ... 
)

References __cob_global::cob_call_params, COB_CHK_PARMS, COB_MODULE_PTR, and cob_u8_ptr.

3687 {
3688  cob_u8_ptr data;
3689  unsigned char *direction;
3690  size_t datalen;
3691  size_t left;
3692  size_t right;
3693  size_t movelen;
3694  size_t centrelen;
3695  size_t n;
3696  size_t shifting;
3697  va_list args;
3698 
3699  COB_CHK_PARMS (C$JUSTIFY, 1);
3700 
3701  if (!COB_MODULE_PTR->cob_procedure_params[0]) {
3702  return 0;
3703  }
3704  data = p1;
3705  datalen = COB_MODULE_PTR->cob_procedure_params[0]->size;
3706  if (datalen < 2) {
3707  return 0;
3708  }
3709  if (data[0] != ' ' && data[datalen - 1] != ' ') {
3710  return 0;
3711  }
3712  for (left = 0; left < datalen; ++left) {
3713  if (data[left] != ' ') {
3714  break;
3715  }
3716  }
3717  if (left == datalen) {
3718  return 0;
3719  }
3720  right = 0;
3721  for (n = datalen - 1; ; --n, ++right) {
3722  if (data[n] != ' ') {
3723  break;
3724  }
3725  if (n == 0) {
3726  break;
3727  }
3728  }
3729  movelen = datalen - left - right;
3730  shifting = 0;
3731  if (cobglobptr->cob_call_params > 1) {
3732  va_start (args, p1);
3733  direction = va_arg (args, unsigned char *);
3734  va_end (args);
3735  if (*direction == 'L') {
3736  shifting = 1;
3737  } else if (*direction == 'C') {
3738  shifting = 2;
3739  }
3740  }
3741  switch (shifting) {
3742  case 1:
3743  memmove (data, &data[left], movelen);
3744  memset (&data[movelen], ' ', datalen - movelen);
3745  break;
3746  case 2:
3747  centrelen = (left + right) / 2;
3748  memmove (&data[centrelen], &data[left], movelen);
3749  memset (data, ' ', centrelen);
3750  if ((left + right) % 2) {
3751  memset (&data[centrelen + movelen], ' ', centrelen + 1);
3752  } else {
3753  memset (&data[centrelen + movelen], ' ', centrelen);
3754  }
3755  break;
3756  default:
3757  memmove (&data[left + right], &data[left], movelen);
3758  memset (data, ' ', datalen - movelen);
3759  break;
3760  }
3761  return 0;
3762 }
COB_EXPIMP int cob_sys_mkdir ( unsigned char *  )

References COB_CHK_PARMS, and cob_sys_create_dir().

5459 {
5460  int ret;
5461 
5462  COB_CHK_PARMS (C$MAKEDIR, 1);
5463 
5464  ret = cob_sys_create_dir (dir);
5465  if (ret < 0) {
5466  ret = 128;
5467  }
5468  return ret;
5469 }
COB_EXPIMP int cob_sys_nimp ( const void *  ,
void *  ,
const int   
)

References COB_CHK_PARMS, and cob_u8_ptr.

3215 {
3216  const cob_u8_ptr data_1 = p1;
3217  cob_u8_ptr data_2 = p2;
3218  size_t n;
3219 
3220  COB_CHK_PARMS (CBL_NIMP, 3);
3221 
3222  if (length <= 0) {
3223  return 0;
3224  }
3225  for (n = 0; n < (size_t)length; ++n) {
3226  data_2[n] = data_1[n] & (~data_2[n]);
3227  }
3228  return 0;
3229 }
COB_EXPIMP int cob_sys_nor ( const void *  ,
void *  ,
const int   
)

References COB_CHK_PARMS, and cob_u8_ptr.

3161 {
3162  const cob_u8_ptr data_1 = p1;
3163  cob_u8_ptr data_2 = p2;
3164  size_t n;
3165 
3166  COB_CHK_PARMS (CBL_NOR, 3);
3167 
3168  if (length <= 0) {
3169  return 0;
3170  }
3171  for (n = 0; n < (size_t)length; ++n) {
3172  data_2[n] = ~(data_1[n] | data_2[n]);
3173  }
3174  return 0;
3175 }
COB_EXPIMP int cob_sys_not ( void *  ,
const int   
)

References COB_CHK_PARMS, and cob_u8_ptr.

3251 {
3252  cob_u8_ptr data_1 = p1;
3253  size_t n;
3254 
3255  COB_CHK_PARMS (CBL_NOT, 2);
3256 
3257  if (length <= 0) {
3258  return 0;
3259  }
3260  for (n = 0; n < (size_t)length; ++n) {
3261  data_1[n] = ~data_1[n];
3262  }
3263  return 0;
3264 }
COB_EXPIMP int cob_sys_oc_nanosleep ( const void *  )

References COB_CHK_PARMS, cob_get_llint(), COB_MODULE_PTR, cob_s64_t, COB_UNUSED, and NULL.

3377 {
3378  cob_s64_t nsecs;
3379 #if defined(_WIN32) || defined(__370__) || defined(__OS400__)
3380  unsigned int msecs;
3381 #elif defined(HAVE_NANO_SLEEP)
3382  struct timespec tsec;
3383 #else
3384  unsigned int msecs;
3385 #endif
3386 
3387  COB_UNUSED (data);
3388 
3389  COB_CHK_PARMS (CBL_OC_NANOSLEEP, 1);
3390 
3391  if (COB_MODULE_PTR->cob_procedure_params[0]) {
3392  nsecs = cob_get_llint (COB_MODULE_PTR->cob_procedure_params[0]);
3393  if (nsecs > 0) {
3394 #ifdef _WIN32
3395  msecs = (unsigned int)(nsecs / 1000000);
3396  if (msecs > 0) {
3397  Sleep (msecs);
3398  }
3399 #elif defined(__370__) || defined(__OS400__)
3400  msecs = (unsigned int)(nsecs / 1000000000);
3401  if (msecs > 0) {
3402  sleep (msecs);
3403  }
3404 #elif defined(HAVE_NANO_SLEEP)
3405  tsec.tv_sec = nsecs / 1000000000;
3406  tsec.tv_nsec = nsecs % 1000000000;
3407  nanosleep (&tsec, NULL);
3408 #else
3409  msecs = (unsigned int)(nsecs / 1000000000);
3410  if (msecs > 0) {
3411  sleep (msecs);
3412  }
3413 #endif
3414  }
3415  }
3416  return 0;
3417 }
COB_EXPIMP int cob_sys_open_file ( unsigned char *  ,
unsigned char *  ,
unsigned char *  ,
unsigned char *  ,
unsigned char *   
)

References COB_CHK_PARMS, COB_UNUSED, and open_cbl_file().

5048 {
5049  COB_UNUSED (file_lock);
5050  COB_UNUSED (file_dev);
5051 
5052  COB_CHK_PARMS (CBL_OPEN_FILE, 5);
5053 
5054  return open_cbl_file (file_name, file_access, file_handle, 0);
5055 }
COB_EXPIMP int cob_sys_or ( const void *  ,
void *  ,
const int   
)

References COB_CHK_PARMS, and cob_u8_ptr.

3143 {
3144  const cob_u8_ptr data_1 = p1;
3145  cob_u8_ptr data_2 = p2;
3146  size_t n;
3147 
3148  COB_CHK_PARMS (CBL_OR, 3);
3149 
3150  if (length <= 0) {
3151  return 0;
3152  }
3153  for (n = 0; n < (size_t)length; ++n) {
3154  data_2[n] |= data_1[n];
3155  }
3156  return 0;
3157 }
COB_EXPIMP int cob_sys_parameter_size ( void *  )

References COB_CHK_PARMS, cob_get_int(), COB_MODULE_PTR, and COB_UNUSED.

3468 {
3469  int n;
3470 
3471  COB_UNUSED (data);
3472 
3473  COB_CHK_PARMS (C$PARAMSIZE, 1);
3474 
3475  if (COB_MODULE_PTR->cob_procedure_params[0]) {
3476  n = cob_get_int (COB_MODULE_PTR->cob_procedure_params[0]);
3477  if (n > 0 && n <= COB_MODULE_PTR->module_num_params) {
3478  n--;
3479  if (COB_MODULE_PTR->next &&
3480  COB_MODULE_PTR->next->cob_procedure_params[n]) {
3481  return (int)COB_MODULE_PTR->next->cob_procedure_params[n]->size;
3482  }
3483  }
3484  }
3485  return 0;
3486 }
COB_EXPIMP int cob_sys_printable ( void *  ,
  ... 
)

References __cob_global::cob_call_params, COB_CHK_PARMS, COB_MODULE_PTR, and cob_u8_ptr.

3654 {
3655  cob_u8_ptr data;
3656  unsigned char *dotptr;
3657  size_t datalen;
3658  size_t n;
3659  unsigned char dotrep;
3660  va_list args;
3661 
3662  COB_CHK_PARMS (C$PRINTABLE, 1);
3663 
3664  if (!COB_MODULE_PTR->cob_procedure_params[0]) {
3665  return 0;
3666  }
3667  data = p1;
3668  datalen = COB_MODULE_PTR->cob_procedure_params[0]->size;
3669  if (cobglobptr->cob_call_params > 1) {
3670  va_start (args, p1);
3671  dotptr = va_arg (args, unsigned char *);
3672  va_end (args);
3673  dotrep = *dotptr;
3674  } else {
3675  dotrep = (unsigned char)'.';
3676  }
3677  for (n = 0; n < datalen; ++n) {
3678  if (!isprint (data[n])) {
3679  data[n] = dotrep;
3680  }
3681  }
3682  return 0;
3683 }
COB_EXPIMP int cob_sys_read_file ( unsigned char *  ,
unsigned char *  ,
unsigned char *  ,
unsigned char *  ,
unsigned char *   
)

References COB_BSWAP_32, COB_BSWAP_64, COB_CHK_PARMS, and cob_s64_t.

5088 {
5089  cob_s64_t off;
5090  int fd;
5091  int len;
5092  int rc;
5093  struct stat st;
5094 
5095  COB_CHK_PARMS (CBL_READ_FILE, 5);
5096 
5097  rc = 0;
5098  memcpy (&fd, file_handle, (size_t)4);
5099  memcpy (&off, file_offset, (size_t)8);
5100  memcpy (&len, file_len, (size_t)4);
5101 #ifndef WORDS_BIGENDIAN
5102  off = COB_BSWAP_64 (off);
5103  len = COB_BSWAP_32 (len);
5104 #endif
5105  if (lseek (fd, (off_t)off, SEEK_SET) == (off_t)-1) {
5106  return -1;
5107  }
5108  if (len > 0) {
5109  rc = read (fd, buf, (size_t)len);
5110  if (rc < 0) {
5111  rc = -1;
5112  } else if (rc == 0) {
5113  rc = 10;
5114  } else {
5115  rc = 0;
5116  }
5117  }
5118  if ((*flags & 0x80) != 0) {
5119  if (fstat (fd, &st) < 0) {
5120  return -1;
5121  }
5122  off = st.st_size;
5123 #ifndef WORDS_BIGENDIAN
5124  off = COB_BSWAP_64 (off);
5125 #endif
5126  memcpy (file_offset, &off, (size_t)8);
5127  }
5128  return rc;
5129 }
COB_EXPIMP int cob_sys_rename_file ( unsigned char *  ,
unsigned char *   
)

References COB_CHK_PARMS, cob_free(), COB_MODULE_PTR, cob_str_from_fld(), and COB_UNUSED.

5319 {
5320  char *fn1;
5321  char *fn2;
5322  int ret;
5323 
5324  COB_UNUSED (fname1);
5325  COB_UNUSED (fname2);
5326 
5327  COB_CHK_PARMS (CBL_RENAME_FILE, 2);
5328 
5329  if (!COB_MODULE_PTR->cob_procedure_params[0]) {
5330  return -1;
5331  }
5332  if (!COB_MODULE_PTR->cob_procedure_params[1]) {
5333  return -1;
5334  }
5335  fn1 = cob_str_from_fld (COB_MODULE_PTR->cob_procedure_params[0]);
5336  fn2 = cob_str_from_fld (COB_MODULE_PTR->cob_procedure_params[1]);
5337  ret = rename (fn1, fn2);
5338  cob_free (fn1);
5339  cob_free (fn2);
5340  if (ret) {
5341  return 128;
5342  }
5343  return 0;
5344 }
COB_EXPIMP int cob_sys_return_args ( void *  )

References COB_CHK_PARMS, COB_MODULE_PTR, cob_set_int(), and COB_UNUSED.

3430 {
3431  COB_UNUSED (data);
3432 
3433  COB_CHK_PARMS (C$NARG, 1);
3434 
3435  if (COB_MODULE_PTR->cob_procedure_params[0]) {
3436  cob_set_int (COB_MODULE_PTR->cob_procedure_params[0],
3437  COB_MODULE_PTR->module_num_params);
3438  }
3439  return 0;
3440 }
COB_EXPIMP int cob_sys_sleep ( const void *  )

References COB_CHK_PARMS, cob_get_int(), COB_MODULE_PTR, and COB_UNUSED.

3632 {
3633  int n;
3634 
3635  COB_UNUSED (data);
3636 
3637  COB_CHK_PARMS (C$SLEEP, 1);
3638 
3639  if (COB_MODULE_PTR->cob_procedure_params[0]) {
3640  n = cob_get_int (COB_MODULE_PTR->cob_procedure_params[0]);
3641  if (n > 0 && n < 3600*24*7) {
3642 #ifdef _WIN32
3643  Sleep (n*1000);
3644 #else
3645  sleep ((unsigned int)n);
3646 #endif
3647  }
3648  }
3649  return 0;
3650 }
COB_EXPIMP int cob_sys_sound_bell ( void  )

References COB_BEEP_VALUE, __cob_global::cob_screen_initialized, and cob_speaker_beep().

1759 {
1760  if (COB_BEEP_VALUE == 9) {
1761  return 0;
1762  }
1763 #ifdef COB_GEN_SCREENIO
1765  COB_BEEP_VALUE != 2) {
1766  cob_screen_init ();
1767  }
1768  cob_beep ();
1769 #else
1770  cob_speaker_beep ();
1771 #endif
1772  return 0;
1773 }
COB_EXPIMP int cob_sys_system ( const void *  )

References _, COB_CHK_PARMS, cob_free(), cob_malloc(), COB_MEDIUM_MAX, COB_MODULE_PTR, cob_runtime_error(), __cob_global::cob_screen_initialized, cob_screen_set_mode(), cob_stop_run(), if(), and unlikely.

3086 {
3087  const char *cmd;
3088  char *buff;
3089  int i;
3090 
3091  COB_CHK_PARMS (SYSTEM, 1);
3092 
3093  if (COB_MODULE_PTR->cob_procedure_params[0]) {
3094  cmd = cmdline;
3095  i = (int)COB_MODULE_PTR->cob_procedure_params[0]->size;
3096  if (unlikely(i > COB_MEDIUM_MAX)) {
3097  cob_runtime_error (_("Parameter to SYSTEM call is larger than 8192 characters"));
3098  cob_stop_run (1);
3099  }
3100  i--;
3101  for (; i >= 0; --i) {
3102  if (cmd[i] != ' ' && cmd[i] != 0) {
3103  break;
3104  }
3105  }
3106  if (i >= 0) {
3107  buff = cob_malloc ((size_t)(i + 2));
3108  memcpy (buff, cmd, (size_t)(i + 1));
3110  cob_screen_set_mode (0);
3111  }
3112  i = system (buff);
3113  cob_free (buff);
3115  cob_screen_set_mode (1U);
3116  }
3117  return i;
3118  }
3119  }
3120  return 1;
3121 }
COB_EXPIMP int cob_sys_tolower ( void *  ,
const int   
)

References COB_CHK_PARMS, cob_u8_ptr, and cob_u8_t.

3359 {
3360  cob_u8_ptr data = p1;
3361  size_t n;
3362 
3363  COB_CHK_PARMS (CBL_TOLOWER, 2);
3364 
3365  if (length > 0) {
3366  for (n = 0; n < (size_t)length; ++n) {
3367  if (isupper (data[n])) {
3368  data[n] = (cob_u8_t)tolower (data[n]);
3369  }
3370  }
3371  }
3372  return 0;
3373 }
COB_EXPIMP int cob_sys_toupper ( void *  ,
const int   
)

References COB_CHK_PARMS, cob_u8_ptr, and cob_u8_t.

3341 {
3342  cob_u8_ptr data = p1;
3343  size_t n;
3344 
3345  COB_CHK_PARMS (CBL_TOUPPER, 2);
3346 
3347  if (length > 0) {
3348  for (n = 0; n < (size_t)length; ++n) {
3349  if (islower (data[n])) {
3350  data[n] = (cob_u8_t)toupper (data[n]);
3351  }
3352  }
3353  }
3354  return 0;
3355 }
COB_EXPIMP int cob_sys_write_file ( unsigned char *  ,
unsigned char *  ,
unsigned char *  ,
unsigned char *  ,
unsigned char *   
)

References COB_BSWAP_32, COB_BSWAP_64, COB_CHK_PARMS, cob_s64_t, and COB_UNUSED.

5135 {
5136  cob_s64_t off;
5137  int fd;
5138  int len;
5139  int rc;
5140 
5141  COB_UNUSED (flags);
5142 
5143  COB_CHK_PARMS (CBL_WRITE_FILE, 5);
5144 
5145  memcpy (&fd, file_handle, (size_t)4);
5146  memcpy (&off, file_offset, (size_t)8);
5147  memcpy (&len, file_len, (size_t)4);
5148 #ifndef WORDS_BIGENDIAN
5149  off = COB_BSWAP_64 (off);
5150  len = COB_BSWAP_32 (len);
5151 #endif
5152  if (lseek (fd, (off_t)off, SEEK_SET) == (off_t)-1) {
5153  return -1;
5154  }
5155  rc = write (fd, buf, (size_t)len);
5156  if (rc < 0) {
5157  return 30;
5158  }
5159  return 0;
5160 }
COB_EXPIMP int cob_sys_x91 ( void *  ,
const void *  ,
void *   
)

References COB_MODULE_PTR, cob_switch, cob_u8_ptr, and p.

3299 {
3300  cob_u8_ptr result = p1;
3301  const cob_u8_ptr func = p2;
3302  cob_u8_ptr parm = p3;
3303  unsigned char *p;
3304  size_t i;
3305 
3306  switch (*func) {
3307  case 11:
3308  /* Set switches */
3309  p = parm;
3310  for (i = 0; i < 8; ++i, ++p) {
3311  if (*p == 0) {
3312  cob_switch[i] = 0;
3313  } else if (*p == 1) {
3314  cob_switch[i] = 1;
3315  }
3316  }
3317  *result = 0;
3318  break;
3319  case 12:
3320  /* Get switches */
3321  p = parm;
3322  for (i = 0; i < 8; ++i, ++p) {
3323  *p = (unsigned char)cob_switch[i];
3324  }
3325  *result = 0;
3326  break;
3327  case 16:
3328  /* Return number of call parameters */
3329  *parm = (unsigned char)COB_MODULE_PTR->module_num_params;
3330  *result = 0;
3331  break;
3332  default:
3333  *result = 1;
3334  break;
3335  }
3336  return 0;
3337 }
COB_EXPIMP int cob_sys_xf4 ( void *  ,
const void *   
)

References COB_CHK_PARMS, and cob_u8_ptr.

3268 {
3269  cob_u8_ptr data_1 = p1;
3270  const cob_u8_ptr data_2 = p2;
3271  size_t n;
3272 
3273  COB_CHK_PARMS (CBL_XF4, 2);
3274 
3275  *data_1 = 0;
3276  for (n = 0; n < 8; ++n) {
3277  *data_1 |= (data_2[n] & 1) << (7 - n);
3278  }
3279  return 0;
3280 }
COB_EXPIMP int cob_sys_xf5 ( const void *  ,
void *   
)

References COB_CHK_PARMS, and cob_u8_ptr.

3284 {
3285  const cob_u8_ptr data_1 = p1;
3286  cob_u8_ptr data_2 = p2;
3287  size_t n;
3288 
3289  COB_CHK_PARMS (CBL_XF5, 2);
3290 
3291  for (n = 0; n < 8; ++n) {
3292  data_2[n] = (*data_1 & (1 << (7 - n))) ? 1 : 0;
3293  }
3294  return 0;
3295 }
COB_EXPIMP int cob_sys_xor ( const void *  ,
void *  ,
const int   
)

References COB_CHK_PARMS, and cob_u8_ptr.

3179 {
3180  const cob_u8_ptr data_1 = p1;
3181  cob_u8_ptr data_2 = p2;
3182  size_t n;
3183 
3184  COB_CHK_PARMS (CBL_XOR, 3);
3185 
3186  if (length <= 0) {
3187  return 0;
3188  }
3189  for (n = 0; n < (size_t)length; ++n) {
3190  data_2[n] ^= data_1[n];
3191  }
3192  return 0;
3193 }
COB_EXPIMP void cob_table_sort ( cob_field ,
const int   
)

References cob_free(), cob_field::data, cob_field::size, and sort_compare().

2297 {
2298  qsort (f->data, (size_t) n, f->size, sort_compare);
2299  cob_free (sort_keys);
2300 }
COB_EXPIMP void cob_table_sort_init ( const size_t  ,
const unsigned char *   
)

References cob_malloc(), COB_MODULE_PTR, sort_collate, and sort_nkeys.

2275 {
2276  sort_nkeys = 0;
2277  sort_keys = cob_malloc (nkeys * sizeof (cob_file_key));
2278  if (collating_sequence) {
2279  sort_collate = collating_sequence;
2280  } else {
2281  sort_collate = COB_MODULE_PTR->collating_sequence;
2282  }
2283 }
COB_EXPIMP void cob_table_sort_init_key ( cob_field ,
const int  ,
const unsigned  int 
)

References cob_file_key::field, cob_file_key::flag, cob_file_key::offset, and sort_nkeys.

2288 {
2289  sort_keys[sort_nkeys].field = field;
2290  sort_keys[sort_nkeys].flag = flag;
2291  sort_keys[sort_nkeys].offset = offset;
2292  sort_nkeys++;
2293 }
COB_EXPIMP void cob_temp_name ( char *  ,
const char *   
)

References COB_FILE_MAX, cob_gettmpdir(), cob_sys_getpid(), cob_temp_iteration, and SLASH_INT.

2913 {
2914  /* Set temporary file name */
2915  if (ext) {
2916  snprintf (filename, (size_t)COB_FILE_MAX, "%s%ccob%d_%d%s",
2917  cob_gettmpdir(), SLASH_INT, cob_sys_getpid(), cob_temp_iteration, ext);
2918  } else {
2919  snprintf (filename, (size_t)COB_FILE_MAX, "%s%ccobsort%d_%d",
2921  }
2922 }
COB_EXPIMP int cob_tidy ( void  )

References cob_initialized, cob_terminate_routines(), exit_hdlrs, exit_handlerlist::next, NULL, and exit_handlerlist::proc.

2975 {
2976  struct exit_handlerlist *h;
2977 
2978  if (!cob_initialized) {
2979  exit (1);
2980  }
2981  if (exit_hdlrs != NULL) {
2982  h = exit_hdlrs;
2983  while (h != NULL) {
2984  h->proc ();
2985  h = h->next;
2986  }
2987  }
2989  return 0;
2990 }
COB_EXPIMP void cob_trace_section ( const char *  ,
const char *  ,
const int   
)

References cob_check_trace_file(), cob_last_sfile, cob_line_trace, COB_MODULE_PTR, and cob_trace_file.

1276 {
1277  const char *s;
1278 
1279  if (cob_line_trace) {
1280  if (!cob_trace_file) {
1282  }
1283  if (source &&
1284  (!cob_last_sfile || strcmp (cob_last_sfile, source))) {
1285  cob_last_sfile = source;
1286  fprintf (cob_trace_file, "Source: '%s'\n", source);
1287  }
1288  if (COB_MODULE_PTR->module_name) {
1289  s = COB_MODULE_PTR->module_name;
1290  } else {
1291  s = "Unknown";
1292  }
1293  fprintf (cob_trace_file, "Program-Id: %-16s ", s);
1294  if (line) {
1295  fprintf (cob_trace_file, "%-34.34sLine: %d\n", para, line);
1296  } else {
1297  fprintf (cob_trace_file, "%s\n", para);
1298  }
1299  fflush (cob_trace_file);
1300  }
1301 }
COB_EXPIMP void cob_unlock_file ( cob_file ,
cob_field  
)

References cob_file_unlock(), COB_STATUS_00_SUCCESS, and save_status().

4451 {
4452  cob_file_unlock (f);
4453  save_status (f, fnstatus, COB_STATUS_00_SUCCESS);
4454 }
COB_EXPIMP void cob_unstring_delimited ( cob_field ,
const cob_u32_t   
)
COB_EXPIMP void cob_unstring_finish ( void  )

References cob_set_exception(), cob_set_int(), cob_field::size, and unstring_offset.

621 {
622  if (unstring_offset < (int)unstring_src->size) {
623  cob_set_exception (COB_EC_OVERFLOW_UNSTRING);
624  }
625 
626  if (unstring_ptr) {
628  }
629 }
COB_EXPIMP void cob_unstring_init ( cob_field ,
cob_field ,
const size_t   
)

References cob_free(), cob_get_int(), cob_malloc(), cob_set_exception(), dlm_list_size, NULL, cob_field::size, unstring_count, unstring_ndlms, unstring_offset, unstring_ptr_copy, and unstring_src_copy.

488 {
489  unstring_src_copy = *src;
491  unstring_ptr = NULL;
492  if (ptr) {
493  unstring_ptr_copy = *ptr;
495  }
496 
497  unstring_offset = 0;
498  unstring_count = 0;
499  unstring_ndlms = 0;
500  cob_set_exception (0);
501  if (num_dlm > dlm_list_size) {
502  cob_free (dlm_list);
503  dlm_list = cob_malloc (num_dlm * sizeof(struct dlm_struct));
504  dlm_list_size = num_dlm;
505  }
506 
507  if (unstring_ptr) {
509  if (unstring_offset < 0 || unstring_offset >= (int)unstring_src->size) {
510  cob_set_exception (COB_EC_OVERFLOW_UNSTRING);
511  }
512  }
513 }
COB_EXPIMP void cob_unstring_into ( cob_field ,
cob_field ,
cob_field  
)

References COB_FIELD_IS_NUMERIC, COB_FIELD_SIZE, cob_get_exception_code(), cob_min_int(), cob_set_int(), cob_str_memcpy(), cob_field::data, if(), NULL, p, cob_field::size, dlm_struct::uns_all, dlm_struct::uns_dlm, unstring_count, unstring_ndlms, and unstring_offset.

525 {
526  unsigned char *p;
527  unsigned char *dp;
528  unsigned char *s;
529  unsigned char *dlm_data;
530  unsigned char *start;
531  size_t dlm_size = 0;
532  int i;
533  int srsize;
534  int dlsize;
535  int match_size = 0;
536  int brkpt = 0;
537 
538  if (cob_get_exception_code ()) {
539  return;
540  }
541 
542  if (unstring_offset >= (int)unstring_src->size) {
543  return;
544  }
545 
546  start = unstring_src->data + unstring_offset;
547  dlm_data = NULL;
548  if (unstring_ndlms == 0) {
549  match_size = cob_min_int ((int)COB_FIELD_SIZE (dst),
551  cob_str_memcpy (dst, start, match_size);
552  unstring_offset += match_size;
553  } else {
554  srsize = (int) unstring_src->size;
555  s = unstring_src->data + srsize;
556  for (p = start; p < s; ++p) {
557  for (i = 0; i < unstring_ndlms; ++i) {
558  dlsize = (int) dlm_list[i].uns_dlm.size;
559  dp = dlm_list[i].uns_dlm.data;
560  if (p + dlsize > s) {
561  continue;
562  }
563  if (!memcmp (p, dp, (size_t)dlsize)) { /* delimiter equal */
564  match_size = (int)(p - start); /* count in */
565  cob_str_memcpy (dst, start, match_size); /* into */
566  unstring_offset += match_size + dlsize; /* with pointer */
567  dlm_data = dp;
568  dlm_size = dlsize;
569  if (dlm_list[i].uns_all) { /* delimited by all */
570  for (p += dlsize ; p < s; p += dlsize) {
571  if (p + dlsize > s) {
572  break;
573  }
574  if (memcmp (p, dp, (size_t)dlsize)) {
575  break;
576  }
577  unstring_offset += dlsize;
578  }
579  }
580  brkpt = 1;
581  break;
582  }
583  }
584  if (brkpt) {
585  break;
586  }
587  }
588  if (!brkpt) {
589  /* No match */
590  match_size = (int)(unstring_src->size - unstring_offset);
591  cob_str_memcpy (dst, start, match_size);
593  dlm_data = NULL;
594  }
595  }
596  unstring_count++;
597 
598  if (dlm) {
599  if (dlm_data) {
600  cob_str_memcpy (dlm, dlm_data, (int) dlm_size);
601  } else if (COB_FIELD_IS_NUMERIC (dlm)) {
602  cob_set_int (dlm, 0);
603  } else {
604  memset (dlm->data, ' ', dlm->size);
605  }
606  }
607 
608  if (cnt) {
609  cob_set_int (cnt, match_size);
610  }
611 }
COB_EXPIMP void cob_unstring_tallying ( cob_field )

References cob_add_int(), and unstring_count.

615 {
616  cob_add_int (f, unstring_count, 0);
617 }
COB_EXPIMP int cob_valid_date_format ( const char *  )
2102 {
2103  return !strcmp (format, "YYYYMMDD")
2104  || !strcmp (format, "YYYY-MM-DD")
2105  || !strcmp (format, "YYYYDDD")
2106  || !strcmp (format, "YYYY-DDD")
2107  || !strcmp (format, "YYYYWwwD")
2108  || !strcmp (format, "YYYY-Www-D");
2109 }
COB_EXPIMP int cob_valid_datetime_format ( const char *  )

References cob_valid_date_format(), cob_valid_time_format(), MAX_DATETIME_STR_LENGTH, parse_date_format_string(), parse_time_format_string(), split_around_t(), time_format::with_colons, and date_format::with_hyphens.

2147 {
2148  char date_format_str[MAX_DATETIME_STR_LENGTH] = { '\0' };
2149  char time_format_str[MAX_DATETIME_STR_LENGTH] = { '\0' };
2150  struct date_format date_format;
2151  struct time_format time_format;
2152 
2153  split_around_t (format, date_format_str, time_format_str);
2154 
2155  if (!cob_valid_date_format (date_format_str)
2156  || !cob_valid_time_format (time_format_str)) {
2157  return 0;
2158  }
2159 
2160  /* Check time and date formats match */
2161  date_format = parse_date_format_string (date_format_str);
2162  time_format = parse_time_format_string (time_format_str);
2164  return 0;
2165  }
2166 
2167  return 1;
2168 }
COB_EXPIMP int cob_valid_time_format ( const char *  )

References time_format::decimal_places, decimal_places_for_seconds(), max_time_decimal_places, rest_is_offset_format(), rest_is_z(), and time_format::with_colons.

2113 {
2114  int with_colons;
2115  ptrdiff_t format_offset;
2116  int decimal_places = 0;
2117 
2118  if (!strncmp (format, "hhmmss", 6)) {
2119  with_colons = 0;
2120  format_offset = 6;
2121  } else if (!strncmp (format, "hh:mm:ss", 8)) {
2122  with_colons = 1;
2123  format_offset = 8;
2124  } else {
2125  return 0;
2126  }
2127 
2128  if (format[format_offset] == '.') {
2129  decimal_places = decimal_places_for_seconds (format, format_offset);
2130  format_offset += decimal_places + 1;
2131  if (!(1 <= decimal_places && decimal_places <= max_time_decimal_places)) {
2132  return 0;
2133  }
2134  }
2135 
2136  if (strlen (format) > format_offset
2137  && !rest_is_z (format + format_offset)
2138  && !rest_is_offset_format (format + format_offset, with_colons)) {
2139  return 0;
2140  }
2141 
2142  return 1;
2143 }
COB_EXPIMP void cob_write ( cob_file ,
cob_field ,
const int  ,
cob_field ,
const unsigned  int 
)

References cob_file::access_mode, check_eop_status, COB_ACCESS_SEQUENTIAL, cob_get_int(), COB_OPEN_EXTEND, COB_OPEN_I_O, COB_OPEN_OUTPUT, COB_STATUS_44_RECORD_OVERFLOW, COB_STATUS_48_OUTPUT_DENIED, cob_file::flag_read_done, cob_file::open_mode, cob_file::organization, cob_file::record, cob_file::record_max, cob_file::record_min, save_status(), cob_field::size, unlikely, cob_file::variable_record, and cob_fileio_funcs::write.

4775 {
4776  f->flag_read_done = 0;
4777 
4778  if (f->access_mode == COB_ACCESS_SEQUENTIAL) {
4779  if (unlikely(f->open_mode != COB_OPEN_OUTPUT &&
4780  f->open_mode != COB_OPEN_EXTEND)) {
4782  return;
4783  }
4784  } else {
4785  if (unlikely(f->open_mode != COB_OPEN_OUTPUT &&
4786  f->open_mode != COB_OPEN_I_O)) {
4788  return;
4789  }
4790  }
4791 
4792  if (f->variable_record) {
4793  f->record->size = (size_t)cob_get_int (f->variable_record);
4794  if (unlikely(f->record->size > rec->size)) {
4795  f->record->size = rec->size;
4796  }
4797  } else {
4798  f->record->size = rec->size;
4799  }
4800 
4801  if (f->record->size < f->record_min || f->record_max < f->record->size) {
4803  return;
4804  }
4805 
4806  check_eop_status = check_eop;
4807  save_status (f, fnstatus,
4808  fileio_funcs[(int)f->organization]->write (f, opt));
4809 }
COB_EXPIMP void print_info ( void  )

References _, COB_BLD_BUILD, COB_BLD_CC, COB_BLD_CFLAGS, COB_BLD_CPPFLAGS, COB_BLD_LD, COB_BLD_LDFLAGS, COB_EXEEXT, COB_MODULE_EXT, COB_OBJECT_EXT, NULL, OC_C_VERSION, OC_C_VERSION_PRF, print_version(), var_print(), and WITH_VARSEQ.

4178  {
4179  char buff[16];
4180  char *s;
4181 
4182  print_version ();
4183  putchar ('\n');
4184  puts (_("Build information"));
4185  var_print (_("Build environment"), COB_BLD_BUILD, "", 0);
4186  var_print ("CC", COB_BLD_CC, "", 0);
4187  var_print ("CPPFLAGS", COB_BLD_CPPFLAGS, "", 0);
4188  var_print ("CFLAGS", COB_BLD_CFLAGS, "", 0);
4189  var_print ("LD", COB_BLD_LD, "", 0);
4190  var_print ("LDFLAGS", COB_BLD_LDFLAGS, "", 0);
4191  putchar ('\n');
4192  printf (_("C version %s%s"), OC_C_VERSION_PRF, OC_C_VERSION);
4193  putchar ('\n');
4194  puts (_("GNU Cobol information"));
4195 
4196 // if ((s = getenv ("COB_LIBRARY_PATH")) != NULL) {
4197 // var_print ("COB_LIBRARY_PATH", s, "", 1);
4198 // }
4199  var_print ("COB_MODULE_EXT", COB_MODULE_EXT, "", 0);
4200  var_print ("COB_OBJECT_EXT", COB_OBJECT_EXT, "", 0);
4201  var_print ("COB_EXEEXT", COB_EXEEXT, "", 0);
4202 
4203 #if defined(USE_LIBDL) || defined(_WIN32)
4204  var_print (_("Dynamic loading"), _("System"), "", 0);
4205 #else
4206  var_print (_("Dynamic loading"), _("Libtool"), "", 0);
4207 #endif
4208 
4209 #ifdef COB_PARAM_CHECK
4210  var_print ("\"CBL_\" param check", _("Enabled"), "", 0);
4211 #else
4212  var_print ("\"CBL_\" param check", _("Disabled"), "", 0);
4213 #endif
4214 
4215  snprintf (buff, sizeof(buff), "%d", WITH_VARSEQ);
4216  var_print (_("Variable format"), buff, "", 0);
4217  if ((s = getenv ("COB_VARSEQ_FORMAT")) != NULL) {
4218  var_print ("COB_VARSEQ_FORMAT", s, "", 1);
4219  }
4220 
4221 #ifdef COB_LI_IS_LL
4222  var_print ("BINARY-C-LONG", _("8 bytes"), "", 0);
4223 #else
4224  var_print ("BINARY-C-LONG", _("4 bytes"), "", 0);
4225 #endif
4226 
4227 #ifdef WITH_SEQRA_EXTFH
4228  var_print (_("Sequential handler"), _("External"), "", 0);
4229 #else
4230  var_print (_("Sequential handler"), _("Internal"), "", 0);
4231 #endif
4232 #ifdef WITH_INDEX_EXTFH
4233  var_print (_("ISAM handler"), _("External"), "", 0);
4234 #endif
4235 #ifdef WITH_DB
4236  var_print (_("ISAM handler"), _("BDB"), "", 0);
4237 #endif
4238 #ifdef WITH_CISAM
4239  var_print (_("ISAM handler"), _("C-ISAM (Experimental)"), "", 0);
4240 #endif
4241 #ifdef WITH_DISAM
4242  var_print (_("ISAM handler"), _("D-ISAM (Experimental)"), "", 0);
4243 #endif
4244 #ifdef WITH_VBISAM
4245  var_print (_("ISAM handler"), _("VBISAM (Experimental)"), "", 0);
4246 #endif
4247 }
COB_EXPIMP void print_runtime_env ( void  )

References _, cob_argc, cob_argv, runtime_env::cob_beep_str_env, __cob_global::cob_beep_value, cob_check_trace_file(), __cob_global::cob_disp_to_stderr, runtime_env::cob_disp_to_stderr_env, __cob_global::cob_display_warn, runtime_env::cob_display_warn_env, runtime_env::cob_do_sync, runtime_env::cob_do_sync_env, __cob_global::cob_env_mangle, runtime_env::cob_env_mangle_env, __cob_global::cob_extended_status, runtime_env::cob_extended_status_env, cob_fast_malloc(), runtime_env::cob_file_path, runtime_env::cob_file_path_env, cob_init(), cob_initialized, cob_int_to_formatted_bytestring(), cob_int_to_string(), runtime_env::cob_legacy, runtime_env::cob_legacy_env, runtime_env::cob_library_path_env, cob_line_trace, runtime_env::cob_line_trace_env, runtime_env::cob_local_edit, runtime_env::cob_local_edit_env, runtime_env::cob_ls_fixed, runtime_env::cob_ls_fixed_env, runtime_env::cob_ls_nulls, runtime_env::cob_ls_nulls_env, runtime_env::cob_ls_uses_cr, runtime_env::cob_ls_uses_cr_env, runtime_env::cob_preload_env, runtime_env::cob_preload_resolved, runtime_env::cob_sort_chunk, COB_SORT_CHUNK, runtime_env::cob_sort_chunk_env, runtime_env::cob_sort_memory, COB_SORT_MEMORY, runtime_env::cob_sort_memory_env, cob_strjoin(), __cob_global::cob_timeout_scale, runtime_env::cob_timeout_scale_env, cob_trace_env, cob_trace_file, __cob_global::cob_unix_lf, runtime_env::cob_unix_lf_env, __cob_global::cob_use_esc, runtime_env::cob_use_esc_env, runtime_env::cob_varseq_type, runtime_env::cob_varseq_type_env, runtime_env::name_convert, runtime_env::name_convert_env, NULL, PATHSEPS, runtime_env::physical_cancel, runtime_env::physical_cancel_env, runtime_env::resolve_path, runtime_env::resolve_size, and var_print().

3999  {
4000  char* no_default;
4001  char* not_set;
4002  char* intstring;
4003  char* intstring2;
4004 
4005  printf("GNU Cobol runtime environment\n\n");
4006  printf("All values were resolved from current environment. \n\n");
4007  /* Alles aus common.c --> cob_init und cob_init_... - einigermaßen sinnvoll sortiert (ggf. Zwischenüberschriften ...*/
4008 
4009  if(!cob_initialized) {
4011  }
4012 
4013  no_default = (char*) _("No");
4014  not_set = (char*) _("not set");
4015  intstring = (char*) cob_fast_malloc(10);
4016  intstring2 = (char*) cob_fast_malloc(10);
4017 
4018  printf(_("Call environment\n"));
4019 
4020  var_print("COB_LIBRARY_PATH", runtimeptr->cob_library_path_env, not_set,
4021  2);
4022  var_print("resolve_path",
4024  (char*) PATHSEPS), not_set, 3);
4025  var_print("COB_PRE_LOAD", runtimeptr->cob_preload_env, not_set, 2);
4026  var_print("base_preload_ptr",
4027  runtimeptr->cob_preload_resolved, not_set, 3);
4028  var_print("COB_LOAD_CASE", runtimeptr->name_convert_env, not_set, 2);
4029  var_print("name_convert",
4030  cob_int_to_string(*(runtimeptr->name_convert), intstring),
4031  no_default, 3);
4032  var_print("COB_PHYSICAL_CANCEL", runtimeptr->physical_cancel_env,
4033  not_set, 2);
4034  var_print("physical_cancel",
4036  no_default, 3);
4037 
4038  printf(_("\n\nFile I/O\n"));
4039  var_print("COB_SYNC", runtimeptr->cob_do_sync_env, not_set, 2);
4040  var_print("cob_do_sync",
4041  cob_int_to_string(*(runtimeptr->cob_do_sync), intstring),
4042  no_default, 3);
4043  var_print("COB_LS_USES_CR", runtimeptr->cob_ls_uses_cr_env, not_set, 2);
4044  var_print("cob_ls_uses_cr",
4046  no_default, 3);
4047 
4048  var_print("COB_SORT_MEMORY", runtimeptr->cob_sort_memory_env, not_set,
4049  2);
4050  var_print("cob_sort_memory",
4052  intstring),
4053  cob_int_to_formatted_bytestring(COB_SORT_MEMORY, intstring2), 3);
4054  var_print("COB_SORT_CHUNK", runtimeptr->cob_sort_chunk_env, not_set, 2);
4055  var_print("cob_sort_chunk",
4057  intstring),
4058  cob_int_to_formatted_bytestring(COB_SORT_CHUNK, intstring2), 3);
4059  var_print("COB_FILE_PATH", runtimeptr->cob_file_path_env, not_set, 2);
4060  var_print("cob_file_path", runtimeptr->cob_file_path, not_set, 3);
4061  var_print("COB_LS_NULLS", runtimeptr->cob_ls_nulls_env, not_set, 2);
4062  var_print("cob_ls_nulls",
4063  cob_int_to_string(*(runtimeptr->cob_ls_nulls), intstring),
4064  no_default, 3);
4065  var_print("COB_LS_FIXED", runtimeptr->cob_ls_fixed_env, not_set, 2);
4066  var_print("cob_ls_fixed",
4067  cob_int_to_string(*(runtimeptr->cob_ls_fixed), intstring),
4068  no_default, 3);
4069  var_print("COB_VARSEQ_FORMAT", runtimeptr->cob_varseq_type_env,
4070  _("0 (default), [2-byte record-length] [0000] [record-data]"), 2);
4071  var_print("cob_varseq_type",
4073  _("0 (default), [2-byte record-length] [0000] [record-data]"), 3);
4074  var_print("COB_UNIX_LF", runtimeptr->cob_unix_lf_env, not_set,
4075  2);
4076  var_print("cob_unix_lf",
4078  no_default, 3);
4079 
4080  if (runtimeptr->cob_local_edit) {
4081  printf(_("\n\nLocale Properties\n"));
4082  var_print("COB_LOCALE_NUMERIC_EDITED", runtimeptr->cob_local_edit_env,
4083  not_set, 2);
4084  var_print("cob_local_edit",
4086  no_default, 3);
4087  }
4088 
4089  printf(_("\n\nScreen I/O\n"));
4090  var_print("COB_REDIRECT_DISPLAY",
4091  runtimeptr->cob_disp_to_stderr_env, not_set, 2);
4092  var_print("cob_disp_to_stderr",
4094  intstring), no_default, 3);
4095  var_print("COB_BELL", runtimeptr->cob_beep_str_env, not_set, 2);
4096  var_print("cob_beep_value", cob_int_to_string(cobglobptr->cob_beep_value, intstring), (char*) "0", 3);
4097  var_print("COB_TIMEOUT_SCALE", runtimeptr->cob_timeout_scale_env,
4098  not_set, 2);
4099  var_print("cob_timeout_scale",
4101  intstring), "1000", 3);
4102  var_print("COB_SCREEN_EXCEPTIONS",
4103  runtimeptr->cob_extended_status_env, not_set, 2);
4104  var_print("cob_extended_status",
4106  intstring), no_default, 3);
4107  var_print("COB_SCREEN_ESC", runtimeptr->cob_use_esc_env,
4108  not_set, 2);
4109  var_print("cob_screen_esc",
4111  no_default, 3);
4112  var_print("COB_LEGACY", runtimeptr->cob_legacy_env,
4113  not_set, 2);
4114  var_print("cob_legacy",
4115  cob_int_to_string(*(runtimeptr->cob_legacy), intstring),
4116  no_default, 3);
4117 
4118  printf(_("\n\nMiscellaneous\n"));
4119  var_print("COB_SET_TRACE", runtimeptr->cob_line_trace_env, not_set, 2);
4120  var_print("cob_line_trace", cob_int_to_string(cob_line_trace, intstring), no_default, 3);
4122  var_print("COB_TRACE_FILE", cob_trace_env, not_set, 2);
4123  if(cob_trace_file != stderr) {
4124  var_print("cob_trace_file", cob_trace_env, NULL, 3);
4125  }
4126  else {
4127  var_print("cob_trace_file", _("stderr (default)"), NULL, 3);
4128  }
4129  var_print("COB_DISABLE_WARNINGS",
4130  runtimeptr->cob_display_warn_env, not_set, 2);
4131  var_print("cob_display_warn",
4133  intstring), no_default, 3);
4134  var_print("COB_ENV_MANGLE", runtimeptr->cob_env_mangle_env,
4135  not_set, 2);
4136  var_print("cob_env_mangle",
4138  no_default, 3);
4139 }
COB_EXPIMP void print_version ( void  )

References _, cob_fast_malloc(), COB_MINI_MAX, COB_TAR_DATE, cobc_buffer, PACKAGE_NAME, PACKAGE_VERSION, and PATCH_LEVEL.

4142  {
4143  char* cobc_buffer;
4144  char month[32];
4145  int day, year;
4146 
4147  cobc_buffer = cob_fast_malloc((size_t) COB_MINI_MAX);
4148 
4149  /* Set up build time stamp */
4150  memset (month, 0, sizeof(month));
4151  day = 0;
4152  year = 0;
4153  sscanf (__DATE__, "%s %d %d", month, &day, &year);
4154 
4155  if (day && year) {
4156  snprintf (cobc_buffer, (size_t)COB_MINI_MAX,
4157  "%s %2.2d %4.4d %s", month, day, year, __TIME__);
4158  } else {
4159  snprintf (cobc_buffer, (size_t)COB_MINI_MAX,
4160  "%s %s", __DATE__, __TIME__);
4161  }
4162 
4163  printf ("libcob (%s) %s.%d\n",
4165  puts ("Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Keisuke Nishida");
4166  puts ("Copyright (C) 2006-2012 Roger While");
4167  puts ("Copyright (C) 2009,2010,2012,2014 Simon Sobisch");
4168  puts (_("This is free software; see the source for copying conditions. There is NO\n\
4169 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."));
4170  printf (_("Built %s"), cobc_buffer);
4171  putchar ('\n');
4172  printf (_("Packaged %s"), COB_TAR_DATE);
4173  putchar ('\n');
4174 
4175 }