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
 
Bypass certain records in COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
josepnass

New User


Joined: 31 Dec 2003
Posts: 16
Location: dc

PostPosted: Fri Aug 08, 2014 6:58 am    Post subject: Bypass certain records in COBOL
Reply with quote

Hi All,


I want to bypass certain records in COBOL I.e. reading a rile if cases equal 223 bypass if not process


Thanks ALl
Back to top
View user's profile Send private message

Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1817
Location: NY,USA

PostPosted: Fri Aug 08, 2014 9:49 am    Post subject:
Reply with quote

Is it a fyi or you want to know how the logic of reading the file till end and for each record check the specific field which = 223 and if you find so then skip and read next record?
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 585
Location: The Universe

PostPosted: Fri Aug 08, 2014 10:19 am    Post subject:
Reply with quote

I don't know about Cobol, but writing code to skip unwanted input is trivial in essentially all programming languages I've ever used. Here is an Assembler example analyzing SMF data.
Code:
         ....
READ     GET   SMF                 Read an SMF record
         LR    3,1                 Copy the record address to reg 3
         USING SMFREC,3            Establish SMF record addressability
         CLI   TIVRCDTY,1          Test if dump header
         BE    READ                Ignore it if so
         CLI   TIVRCDTY,2          Test if dump trailer
         BE    READ                Ignore it if so
         TP    TIVRCDTE            Verify record date is packed decimal
         BNZ   READ                Ignore record if not
         ICM   0,B'1111',TIVRCDTS  Load record time of day
         BM    READ                Ignore record if time of day is bad
         C     0,=A(100*24*60*60)  Test time of day
         BNL   READ                Ignore record if time of day is bad
         CLI   TIVRCDTY,34         Test if TSO end of session
         BNE   READ                Br if not
         TP    TIVONDTE            Verify LOGON date is packed decimal
         BNZ   READ                Br if not
         ....
As you can see data is ignored for a multitude of reasons.
  1. Record types 1 or 2.
  2. Record date is not packed decimal
  3. Record time of day doesn't make sense.
  4. Record is not type 34
  5. TIVONDTE field in a type 34 record is not packed decimal
For those of you who are not up date in Assembler, the TP instruction tests a field to see if it contains valid packed decimal data.
Back to top
View user's profile Send private message
josepnass

New User


Joined: 31 Dec 2003
Posts: 16
Location: dc

PostPosted: Fri Aug 08, 2014 4:53 pm    Post subject:
Reply with quote

reading the file and not in assembler but Cobol is record type is 123 for example then bypass that record and move on ..


Rohit Umarjikar wrote:
Is it a fyi or you want to know how the logic of reading the file till end and for each record check the specific field which = 223 and if you find so then skip and read next record?
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2442
Location: Netherlands, Amstelveen

PostPosted: Fri Aug 08, 2014 4:57 pm    Post subject:
Reply with quote

Mainframe Skills: cobol adabas natural JCL

As far as i see it, you know already, but you want to test if we know.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1817
Location: NY,USA

PostPosted: Fri Aug 08, 2014 7:29 pm    Post subject:
Reply with quote

Note: This is only for example and change the file layout as per your requirements.
Code:
INPUT-OUTPUT SECTION.                                     
FILE-CONTROL.                                             
    SELECT file-in                     ASSIGN TO Input.   
DATA  DIVISION.                             
FILE SECTION.                                                                         
FD  file-in                               
    BLOCK CONTAINS 0 RECORDS               
    RECORDING MODE IS F                     
    LABEL RECORDS ARE STANDARD.             
01 ws-rec.
 05 ws-check-code PIC x(3).
 05 Ws-other         PIC x(7). 
WORKING STORAGE SECTION.
05  WS-EOF          PIC x(1) VALUE 'N'.
    88  eof             VALUE 'Y'.
PROCEDURE DIVISION.
OPEN INPUT  file-in
perform 100-read-infile thru 100-exit until eof
100-read-infile.
initialize ws-rec
read file-in             
  AT END                 
     SET eof TO TRUE
  NOT AT END 
  if ws-check-code = '123' or '223'
     continue( do nothing/skip)
  else
     process
 end-if
end-read
.             
.
.
Close file-in
goback.
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 -> All Other Mainframe Topics 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 Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm
No new posts Matching and unmatched records!! Vignesh Sid SYNCSORT 3 Thu Nov 09, 2017 11:22 am
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm

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