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
 

 

how can i access ascii value of character in cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
nileshbhosle

New User


Joined: 25 Feb 2008
Posts: 9
Location: hydrabad

PostPosted: Wed Mar 19, 2008 6:39 pm    Post subject: how can i access ascii value of character in cobol
Reply with quote

I want to acess the ascii values of character as well as for special character.
Back to top
View user's profile Send private message

Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Wed Mar 19, 2008 7:41 pm    Post subject:
Reply with quote

Are you looking for this?

The ORD function returns an integer value that is the ordinal position of its argument in the collating sequence for the program. The lowest ordinal position is 1.
Code:
... FUNCTION ORD(arg1) ... 

The returned value is the ordinal position of arg1 in the collating
sequence for the program; it ranges from 1 to 256 depending on the
collating sequence.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1228
Location: Israel

PostPosted: Wed Mar 19, 2008 9:16 pm    Post subject:
Reply with quote

Here is the code for my CHARSET exec.
When you run it, it shows the decimal and the hexadecimal value and the character symbol.
But, this is EBCDIC, not ASCII.

Code:
/* REXX */
Trace O
Address TSO "#PUT CLEAR"
Line = ""
Do Ix = 0 to 15
   Do Iy = 0 to 15
      Num = (Ix * 16) + Iy
      Line = Line" "Right(Num,3)" "Right(D2X(Num),2)" " D2C(Num)"|"
      If Length(Line) > 75 Then Do
         Say Line
         Line = ""
      End
   End
End
Say Line
Exit
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: Wed Mar 19, 2008 9:46 pm    Post subject:
Reply with quote

Hello,

Quote:
I want to acess the ascii values of character as well as for special character.
Please explain what this is asking. Show with examples.
Back to top
View user's profile Send private message
Bill Dennis

Active Member


Joined: 17 Aug 2007
Posts: 562
Location: Iowa, USA

PostPosted: Wed Mar 19, 2008 10:44 pm    Post subject:
Reply with quote

For example, a zero '0' is EBCDIC x'F0' and ASCII x'30'.

Do you want to translate a single character (or string) from EBCDIC to ASCII values within a program? What will you do with it?
Back to top
View user's profile Send private message
nileshbhosle

New User


Joined: 25 Feb 2008
Posts: 9
Location: hydrabad

PostPosted: Thu Mar 20, 2008 1:11 pm    Post subject: im doing the password encryption program
Reply with quote

im doing the password encryption program thts why i require ascii value of alphabets.so whenever i want i can append according to ascii value to password string.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10257
Location: italy

PostPosted: Thu Mar 20, 2008 1:46 pm    Post subject: Reply to: how can i access ascii value of character in cobol
Reply with quote

it would be better if You described a bit more Your environment
in any environment bytes are just bytes,
the ASCII EBCDIC UTF stuff comes out only in regard to "displaying" chars

why in heaven in a mainframe world You need to care about ASCII
all the translation should be automagically carried on by "middleware"

usually all the password stuff is completely being taken care of by appropriate software

Organizational warning!
( seen it done it ) in house password management and encryption stuff
seldom/never pass any serious security auditing/ISO_certification
Back to top
View user's profile Send private message
nileshbhosle

New User


Joined: 25 Feb 2008
Posts: 9
Location: hydrabad

PostPosted: Thu Mar 20, 2008 2:39 pm    Post subject: i want ascii values
Reply with quote

my requirment is i want to calculate total number of capital,small letter and special character and then i want to convert caps in small and small into caps and i want to append the ascii numeric value to entered string along with my

original string+all caps letter converted into small + all small letter into caps + interger value of special so this wil my total password.

then if i hav ascii value then i can easily do this.
Back to top
View user's profile Send private message
Bill Dennis

Active Member


Joined: 17 Aug 2007
Posts: 562
Location: Iowa, USA

PostPosted: Thu Mar 20, 2008 6:52 pm    Post subject:
Reply with quote

I don't think you really mean ASCII, you just want to perform math operations on the numeric value of a character.

You probably want to redefine the field or move bytes to a new field defined as numeric and perform your addition. What language are you coding?
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: Thu Mar 20, 2008 7:43 pm    Post subject:
Reply with quote

Hello,

Who provided the direction that you need to be concerned with ascii?

If you are entering userid/password on a "mianframe terminal", this will not be an issue.

What is the reason to write something beyond the standard security used on your system? Your application might need to customize menus or show screens differently based on the userid or group, but the security of the application is almost always better served by the standard system security.

As Enrico mentioned, home-grown security code is nearly always weak.
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm


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