IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

differnce in finding the length cobol II and cobol III


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
madhan1582

New User


Joined: 02 Aug 2005
Posts: 3
Location: chennai

PostPosted: Wed Aug 17, 2005 11:59 am
Reply with quote

In cobol III i will find the length of the variable using the function

function lenght(variable-name)

but in cobol II its not allowed to use length function ( so i have to use inspect in that case it is returning the length of the variable which is declared.
eg;
01 varstr pic x(15) value 'hari'.
01 cnt pic 9(2).
if i am using the following syntax it is giving me the result 15 ,whether it will be possible to find the values length i.e 4 (as in length function).

Inspect varstr talling cnt for charecters.

pls give me the result if u people know it.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Wed Aug 17, 2005 12:12 pm
Reply with quote

Hi Madhan,

One post...Two queries....With out Search....in Wrong Forum.... icon_biggrin.gif

Quote:
if i am using the following syntax it is giving me the result 15 ,whether it will be possible to find the values length i.e 4 (as in length function).


You can do it like this.

Code:
ENVIRONMENT DIVISION.                                       
CONFIGURATION SECTION.             
SPECIAL-NAMES. CLASS VALID-DATA IS 'A' THRU 'Z'.   
..           
..
..
INSPECT VARSTR TALLYING CNT
        FOR ALL VALID-DATA.

You can also add more special characters as per your requirements in SPECIAL-NAMES clause.

Regards,

Priyesh.
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts IBM IMU Utility for Easytrieve Code t... IBM Tools 0
No new posts Big Five Personality Test in COBOL - ... COBOL Programming 0
No new posts I wrote a Hallmark Movie Plot Generat... COBOL Programming 0
No new posts COBOL Text Adventure Engine for TK4- ... COBOL Programming 0
No new posts Cobcalc: An Algebraic Expression Eval... COBOL Programming 10
Search our Forums:


Back to Top