Kim Borgman writes:
-----Original Message-----
From: Kim Borgman [mailto:[log in to unmask]]
Sent: Monday, January 08, 2001 9:34 AM
To: [log in to unmask]
Subject: COBOL QUESTION
Here is a good one for someone.
Using cobol to generate a rpt. Want to test the 11th item in an array.
(occurs 42 times).
But I want to test the 3rd character of that field to see if it is numeric
or not. Normally I would do: FIELD(3:1), but I have to look at the array
now.
I tried FIELD(11)(3:1). Error.
also tried FIELD(11),(3:1). Error.
Any advice out there ?
Yes I can move it to a working storage area and test it there, but I should
be able to do it with one command.
----------------------------------------------------------
Works for me, here is an example.
:COB85XLG TESTS
PAGE 0001 COBOL II/iX HP31500A.04.19 [85] Copyright Hewlett-Packard CO.
1987
00001 COBCNTL 000100* The following are defaults for Compatibility mode
compi
ler.
00002 COBCNTL 000200*CONTROL
LIST,SOURCE,NOCODE,NOCROSSREF,ERRORS=100,NOVERBS,
WARN
00003 COBCNTL 000300*CONTROL
LINES=60,NOMAP,MIXED,QUOTE=",NOSTDWARN,SYNC16,IND
EX16
00004 COBCNTL 000400*
00005 COBCNTL 000500* The following are defaults for Native compiler.
00006 COBCNTL 000600*
00007 COBCNTL 000700*CONTROL
LIST,SOURCE,NOCODE,NOCROSSREF,ERRORS=100,NOVERBS,
WARN
00008 COBCNTL 000800*CONTROL
LINES=60,NOMAP,MIXED,QUOTE=",NOSTDWARN,SYNC32,IND
EX32
00009 COBCNTL 000900*CONTROL NOVALIDATE,OPTIMIZE=0
00010 COBCNTL 001000*
00011 COBCNTL 001100* For any other options, redirect COBCNTL.PUB.SYS by
usi
ng
00012 COBCNTL 001200* a file equation.
00013 COBCNTL 001300*
00014 001000 IDENTIFICATION DIVISION.
00015 001100 PROGRAM-ID. TEST.
00016 001200 DATA DIVISION.
00017 001300 WORKING-STORAGE SECTION.
00018 001400 01 BIG-ARRAY.
00019 001500 03 CHECK-FIELD OCCURS 42 TIMES PIC X(5).
00020 001600 PROCEDURE DIVISION.
00021 001700 TEST-IT.
00022 001800 MOVE "AB1CD" TO CHECK-FIELD (11).
00023 001900
00024 002000 IF CHECK-FIELD (11) (3:1) NUMERIC
00025 002100 DISPLAY "IT'S NUMERIC"
00026 002200 ELSE
00027 002300 DISPLAY "IT'S NOT NUMERIC".
00028 002400
00029 002500 STOP RUN.
0 ERROR(s), 0 QUESTIONABLE, 0 WARNING(s)
DATA AREA IS FC BYTES.
CPU TIME = 0:00:00. WALL TIME = 0:00:00.
END OF PROGRAM
END OF COMPILE
HP Link Editor/iX (HP30315A.06.14) Copyright Hewlett-Packard Co 1986
LinkEd> link
END OF LINK
IT'S NUMERIC
END OF PROGRAM
:
Mike Berkowitz
Guess? Inc.
|