Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Cobol interview questions

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Thu Nov 17, 2005 11:57 am    Post subject: Cobol interview questions
Reply with quote

Difference between line sequential and sequential?
what are the data types used in cobol?
there r 1000 records in a file. u have 2 read 10,20,30th records upto 1000 and write it into another file.
sort a file using bubble sort.
Back to top
View user's profile Send private message

parikshit123

Active User


Joined: 01 Jul 2005
Posts: 269
Location: India

PostPosted: Thu Nov 17, 2005 2:37 pm    Post subject:
Reply with quote

Hi,

I think there is no difference between sequential and line sequential files.

there are three major categories of data types in COBOL.
NUMERIC, ALPHANUMERIC AND ALPHABETIC.

You can find bubble sort algorithm via googling its a very trivial sorting algorithm.

thanks,
Parikshit.
Back to top
View user's profile Send private message
parikshit123

Active User


Joined: 01 Jul 2005
Posts: 269
Location: India

PostPosted: Thu Nov 17, 2005 6:11 pm    Post subject:
Reply with quote

Hi,

Here is a pseudocode for bubble sort.

Code:

Working Storage Entries:

       01  WS-BANKBRCH-TABLE.
           05  WS-BANKBRCH-ENTRY                   OCCURS 1000 TIMES
                                                   INDEXED BY
                                                   X-WS-BB.
               07  WS-BANKBRCH-9-16    PIC 9(16).
               07  WS-BANKBRCH-9-16-R      REDEFINES WS-BANKBRCH-9-16.
                   09  WS-BANKBRCH-FR  PIC 9(08).
                   09  WS-BANKBRCH-FR-R    REDEFINES WS-BANKBRCH-FR.
                       11  WS-BANK-FR  PIC 9(04).
                       11  WS-BRCH-FR  PIC 9(04).
                   09  WS-BANKBRCH-TO  PIC 9(08).
                   09  WS-BANKBRCH-TO-R    REDEFINES WS-BANKBRCH-TO.
                       11  WS-BANK-TO  PIC 9(04).
                       11  WS-BRCH-TO  PIC 9(04).
       01  WS-BUBBLE-SORT-WORK.
           05  WS-TIMES                PIC S9(04)      COMP VALUE ZEROS.
           05  WS-NBR-TIMES            PIC S9(04)      COMP VALUE ZEROS.
           05  WS-HOLD-ENTRY           PIC X(16)       VALUE LOW-VALUES.
           05  WS-SWAP-OCCURRED        PIC X(01)       VALUE SPACE.

   Procedure Code

           MOVE 1                   TO WS-TIMES.
           MOVE 'Y'                 TO WS-SWAP-OCCURRED.
           PERFORM UNTIL WS-SWAP-OCCURRED = 'N'
              SET X-WS-BB           TO 1
              MOVE 'N'              TO WS-SWAP-OCCURRED
              COMPUTE WS-NBR-TIMES = 1000 - WS-TIMES
              PERFORM WS-NBR-TIMES TIMES
                 IF WS-BANKBRCH-9-16 (X-WS-BB + 1) NOT = ZEROS
                    IF WS-BANKBRCH-FR (X-WS-BB) GREATER THAN
                                   WS-BANKBRCH-FR (X-WS-BB + 1)
                    OR WS-BANKBRCH-9-16 (X-WS-BB) = ZEROS
                       MOVE WS-BANKBRCH-ENTRY (X-WS-BB)
                                   TO WS-HOLD-ENTRY
                       MOVE WS-BANKBRCH-ENTRY (X-WS-BB + 1)
                                   TO WS-BANKBRCH-ENTRY (X-WS-BB)
                       MOVE WS-HOLD-ENTRY TO
                                   WS-BANKBRCH-ENTRY (X-WS-BB + 1)
                       MOVE 'Y'    TO WS-SWAP-OCCURRED
                    END-IF
                 END-IF
                 SET X-WS-BB       UP BY 1
              END-PERFORM
              ADD 1                TO WS-TIMES
           END-PERFORM.

Back to top
View user's profile Send private message
mf_karthik

New User


Joined: 26 Jul 2005
Posts: 55

PostPosted: Thu Nov 17, 2005 9:47 pm    Post subject: Re: Cobol interview questions
Reply with quote

thank you parikshit for your answers could you plz explain abt bubble sort?

there r 1000 records in a file. u have 2 read 10,20,30th records upto 1000 and write it into another file need cobol logic anybody plzzzz
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 -> Mainframe Interview Questions 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 to fetch the content by using s... arunc55 COBOL Programming 4 Fri Nov 17, 2017 1:25 pm
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts COBOL - EXIT statement weird behavior anthony.pangestu COBOL Programming 0 Fri Oct 27, 2017 9:57 am
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us