MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Few Questions in COBOL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
ST
Beginner


Joined: 04 Jan 2003
Posts: 24
Topics: 12

PostPosted: Mon Jan 06, 2003 10:46 am    Post subject: Few Questions in COBOL Reply with quote

Hi,
Can anyone let me know answers to the following
1) How we can check palindrome in Cobol ex: string 'AKA' in other way is also 'AKA'
2) Upcase and lowercase of a string ex:abc to be converted as ABC and vise versa
3) Reverse a string say ex: 1234 is to be converted as 4321? is it thru Reverse video?
4) File status for 'open' problem in a SEQ file is it 90 or 92?
5)How can we find out no. of records in a PS file where when we don't have access to it even Browse?

Thanks in adv
ST
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Jan 06, 2003 11:31 am    Post subject: Reply with quote

ST,

1.
Code:

WORKING-STORAGE SECTION.                               
                                                       
01  MY-STRING            PIC X(3) VALUE 'AKA'.         
01  REV-STRING           PIC X(3).                     
                                                       
PROCEDURE DIVISION.                                   
                                                       
     MOVE FUNCTION REVERSE(MY-STRING) TO REV-STRING   
                                                       
     IF MY-STRING = REV-STRING                         
        DISPLAY 'THE GIVEN STRING IS A PALINDROME'     
     ELSE                                             
        DISPLAY 'THE GIVEN STRING IS NOT A PALINDROME'
     END-IF                                           
                                                       
     GOBACK.                                           



2.Converting to uppercase or lowercase (UPPER-CASE, LOWER-CASE)

3.Converting to reverse order (REVERSE)

4.For sequential files the open error is 05 and for vsam files it is 35.

5.You cannot find the no: of records if you don't have access to browse the file.

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ST
Beginner


Joined: 04 Jan 2003
Posts: 24
Topics: 12

PostPosted: Mon Jan 06, 2003 1:06 pm    Post subject: Reply with quote

Kolusu,
Thanks a lot.....

But cant we find out the no. of records by using SORT, sortin and sortout will display the no. of records..doesn't it..?


ST
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Jan 06, 2003 1:18 pm    Post subject: Reply with quote

ST,

There are so many ways to find the no: of records in a file.check this link for various ways to find the no: of records in a file.

Counting no: of records in a file

But if you don't have access to browse the dataset, then none of solutions listed in the above link will work.All the batch jobs will abend with S913 with a reason code 38.

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
niks_jude
Beginner


Joined: 23 Nov 2006
Posts: 8
Topics: 2

PostPosted: Mon Dec 04, 2006 5:08 am    Post subject: Reply with quote

The palindroome check would work only when the string completely occupies the variable field.
Eg.Won't work for this.
01 str pic x(10) value "rar ".
rev-str = " rar"
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group