Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Comparision logic for Alpha-numeric fields in PL1

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
op

New User


Joined: 31 Oct 2006
Posts: 48
Location: Chennai

PostPosted: Tue Sep 25, 2007 8:11 pm    Post subject: Comparision logic for Alpha-numeric fields in PL1
Reply with quote

Hi,

In the input file, a VB dataset, I do have randomly many records of the same header (position 1 3).

I am supposed to select only 1 record with the highest value in a CHAR field (position 24). But the values in this field are 0-9,A-Z (the values are in EBCDIC format).

But, the ascending order of preference in the program should be 0-9,A-Z (0 being the lowest and Z being the highest).

As we know, A-Z is less compared to 0-9 in EBCDIC format.

Is there any logic to do the comparison as I require?

Thanks in advance
OP
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Sep 30, 2007 2:59 am    Post subject:
Reply with quote

Hello,

As there have been no other suggestions, one thing you might do is a 2-part compare.

First, check to see if the value is greater than Z. If it is, skip that record.

Second, compare the current value against the previous highest saved value. If "this" value is greater that the previoujs "hi", save it.

When EOF is reached, the last value saved is the one youj want.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Sun Sep 30, 2007 3:54 am    Post subject:
Reply with quote

Dick, are you saying the esteemed PL/I does not have a function like the Alphabet clause in COBOL?
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Sun Sep 30, 2007 4:12 am    Post subject:
Reply with quote

Quote:
First, check to see if the value is greater than Z. If it is, skip that record.

What will happen for a set of records ( I don't know the context ) without any characters A from Z; only digits.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Sep 30, 2007 5:04 am    Post subject:
Reply with quote

Good catch, Pierre icon_smile.gif

I suppose that if the value is greater than Z (0-9), that "hi" value could be saved in a zero29-hi field. At EOF, if there was no A-Z value, the 0-9 value would be it icon_wink.gif

Hi Bill,

As i've only helped trouble-shoot pl/i and don't actually speak the language, i don't know. I suspect that even if pl/i supports "alphabetic" it doesn't support an "emulate ascii" collating sequence.


I guess the field might be converted to ascii and then the comparison done icon_confused.gif
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Sun Sep 30, 2007 8:01 am    Post subject:
Reply with quote

OP
If your reqt is just sorting the records in different sequence then you can try in SORT with ALTSEQ.
Create the output file and then run a sort step.
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Sun Sep 30, 2007 1:29 pm    Post subject:
Reply with quote

Note : the piece of tests is obviously valid but here just for information

With the help of PLIASCII
Code:
DCL ZEBCDIC CHAR(1)  INIT(' ');
DCL ZASCII  CHAR(1)  INIT(' ');
DCL PTRE    PTR;
DCL PTRA    PTR;
DCL ZL      BIN FIXED(31,0)  INIT(1);
.....................
ZEBCDIC   = 'F1'X;
ZASCII    = '00'X;
PTRE      = ADDR(ZEBCDIC);
PTRA      = ADDR(ZASCII);
CALL PLIASCII(ZASCII,ZEBCDIC,ZL);


Note : ZEBCDIC may overlap ZASCII( refering to a field of record ).

Cheers
Pierre
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us