View previous topic :: View next topic
|
Author |
Message |
Aravind_mf
New User
Joined: 06 Mar 2009 Posts: 13 Location: chennai
|
|
|
|
I have a Alphanumeric variable PSSPRT-DATE X(6) ehich contains date in the format MMDDYY.
Can I use the alphanueric variable in following comparision with Numeric value?
IF PSSPRT-DATE(5:2) > 50 or do I need to use
IF PSSPRT-DATE(5:2) > '50'
The values in position 5 and 6 is always going to be numeric. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Yes, use '50' and you'll be fine.
What did you find in the manual?
Mr. Bill |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Code: |
01 PSSPRT-DATE.
05 PSSPRT-DATE-DD PIC XX.
05 PSSPRT-DATE-MM PIC XX.
05 PSSPRT-DATE-YY PIC XX.
01 YEAR-1950-YY PIC XX VALUE "50".
IF PSSPRT-DATE-YY GREATER THAN YEAR-1950-YY |
What in heck's name is wrong with doing it like that? What's the lazy reference-modification for? Too much to type for you? I hope it is you who maintains your programs.
I guess you're not even thinking how your colleagues have done it? Let's do it six different ways and get at least some of them nearly right. Oh. They all used reference-modification as well.
It funny to do something a "fancy" obscure way, and then not know whether to code a numeric or alphanumeric literal. Doesn't that tell you you could have made your own job(s) easier?
[/code] |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
the way these rookies use reference modification
you'd think they had to punch tab cards for their programs.......
5 will get you 10 that some rookie asks what a tab card is.
by the way,
reference modification automatically creates an alphanumeric (that's pic x, by the way) |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Code: |
FD for input record.
01 A PIC X(nnn1).
FD for output record.
01 B PIC X(nnn2).
WORKING-STORAGE SECTION.
01 C COMP-3 PIC S9(18).
01 D COMP-3 PIC S9(18).
01 E COMP PIC S9(18).
01 F COMP PIC S9(18).
01 G PIC X(enough). |
Assuming no floating-point numbers, I think it would be possible to construct an entire "working" program with reference-modification and a few MOVE ZEROs plus COMPUTE. Read input, do some data maninpulation, do some calculation, construct output record. Plus some IO statements, of course. Even adding some reference files, no problem. Gosh, handle saving values, tables. Just make the G big enough to cover everything needed. Can always make it bigger as you go along.
Just think how easy to get a clean compile. How little to type.
If you don't like the idea of trying to debug or amend it, why start out on that route? |
|
Back to top |
|
|
|