STRING LENGTH

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
User avatar
ibmlearner
Member
Posts: 13
Joined: Sat Dec 02, 2006 5:57 pm

STRING LENGTH

Post by ibmlearner » Thu Mar 08, 2007 8:07 pm

HI ALL ,,

HOW TO FIND THE LENGTH OF THE STRING ???

SAY

01 A PIC X(10)

I HAVE USED ONLY 7 BYTES.

HOW TO CALCULATE THIS ????

IS THERE ANY LOGIC ????
Thanks & Regards
-------------------------
Learner

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Thu Mar 08, 2007 10:01 pm

ibmlearner,

the data representation of "PIC X(10)" in COBOL means a data area defined for use as alphanumeric and with a fixed length of 10.

now, if you wish to determine the number of char within the data area then you could use an INSPECT statement or 'float a register' on the data to interrogate each byte.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others