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

Skip the record


IBM Mainframe Forums -> FAQ & Basics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mitha

New User


Joined: 01 Dec 2021
Posts: 19
Location: India

PostPosted: Wed Dec 08, 2021 4:39 pm
Reply with quote

Hii all, I need code snippet or logic to skip the record

In my case,
Loan|Policy|Total Premium Due
1715276|R1212863|83.58 => this is the value present in my input file and it should not read that first line [ Loan|Policy|Total Premium Due ] .

.> I declared two variable WS-COUNT ,WS-COUNT1 to store values of number before and after decimal . For eg WS-COUNT = 83 and WS-COUNT1 =58 ,83 and 58 values present in the input file.

.> Likewise first line also store WS-COUNT = TOTAL PREMI and WS-COUNT1 =
' ' .Based on this variable , Can anyone say me how to not show that first line in my output. Please reply !!!!.Urgent[/u][/b]
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Wed Dec 08, 2021 5:15 pm
Reply with quote

Just do not write the unwanted record into your output “file”, then you will not “show” it there.

That’s it. 358.gif
Back to top
View user's profile Send private message
mitha

New User


Joined: 01 Dec 2021
Posts: 19
Location: India

PostPosted: Wed Dec 08, 2021 5:21 pm
Reply with quote

I need to give some condition for that to not show in spool. It should only show second line which I mentioned.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Wed Dec 08, 2021 5:31 pm
Reply with quote

mitha wrote:
I need to give some condition for that to not show in spool. It should only show second line which I mentioned.

This has nothing to do with COBOL programming.

Please explain your case more detailed.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Thu Dec 09, 2021 3:18 am
Reply with quote

Just do a READ first after OPEN and that will skip the header record and then do a read of this in loop.
Moved to student section.
Back to top
View user's profile Send private message
mitha

New User


Joined: 01 Dec 2021
Posts: 19
Location: India

PostPosted: Thu Dec 09, 2021 11:32 am
Reply with quote

Ok.Thanks for your information.I need another clarity.
=> As I told WS-COUNT will store 83 and WS-COUNT1 will store 58[refer my first message ]
=> I am giving some condition to check whether it is valid or not .If it is invalid means need to display LOAN NUMBER and amount
=> Everything is working fine no problem.
=>But along with that [ 00000000 ] is displaying in spool.Why it is showing like this without any display statement.I don't know about this.Can anyone say how to remove that in spool. Can anyone share your thoughts?

*** I attached the document with code and output.Please refer to that*****
Back to top
View user's profile Send private message
mitha

New User


Joined: 01 Dec 2021
Posts: 19
Location: India

PostPosted: Thu Dec 09, 2021 11:35 am
Reply with quote

Output showing in spool sysout:

00000000000
00000000000
00000000000
****************************************
LOAN NUMBER : 1867513
AMOUNT IS INVALID : 141.4
****************************************

Need to display only loan number and amount
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Thu Dec 09, 2021 12:11 pm
Reply with quote

I would recommend you to read about the IF statement in COBOL.

And also:
Code:
read carefully how to use the CODE tags at this forum
Back to top
View user's profile Send private message
mitha

New User


Joined: 01 Dec 2021
Posts: 19
Location: India

PostPosted: Thu Dec 09, 2021 12:14 pm
Reply with quote

Can you explain it cleraly.Because I couldn't understand or can you share your code snippet plz to remove this
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Thu Dec 09, 2021 12:35 pm
Reply with quote

mitha wrote:
Can you explain it cleraly.Because I couldn't understand or can you share your code snippet plz to remove this

Code:
 . . . .
IF {need to display amount?}
   DISPLAY {amount information}
END-IF
 . . . .
Back to top
View user's profile Send private message
mitha

New User


Joined: 01 Dec 2021
Posts: 19
Location: India

PostPosted: Thu Dec 09, 2021 12:42 pm
Reply with quote

I tried now,

IF WS-INVALID-AMOUNT
DISPLAY '****************************************'
DISPLAY ' LOAN NUMBER : ' ICURR-LOAN-NUM-D
DISPLAY ' AMOUNT IS INVALID : ' ICURR-AMOUNT-X-D
DISPLAY '****************************************'
END-IF.

But still 0000000 is showing in spool,

00000000000
00000000000
00000000000
****************************************
LOAN NUMBER : 1867513
AMOUNT IS INVALID : 141.4
****************************************
00000000000
****************************************
LOAN NUMBER : 385125109 icon_sad.gif icon_sad.gif
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Thu Dec 09, 2021 1:12 pm
Reply with quote

1. Please, learn finally: how to use the CODE tags for your samples.

2. Your unwanted 00000000000 value is displayed from a part of code nor shown in your samples. Find that part of code, and fix it. So far there is nothing to talk about.
Back to top
View user's profile Send private message
mitha

New User


Joined: 01 Dec 2021
Posts: 19
Location: India

PostPosted: Thu Dec 09, 2021 4:33 pm
Reply with quote

Thank you .I completed my work icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> FAQ & Basics

 


Similar Topics
Topic Forum Replies
No new posts Copy only TEXT or String from a record SYNCSORT 4
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts how to complete the end of a record w... DFSORT/ICETOOL 2
No new posts Sort based on the record type DFSORT/ICETOOL 1
Search our Forums:

Back to Top