View previous topic :: View next topic
|
Author |
Message |
mitha
New User
Joined: 01 Dec 2021 Posts: 19 Location: India
|
|
|
|
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 |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
Just do not write the unwanted record into your output “file”, then you will not “show” it there.
That’s it. |
|
Back to top |
|
|
mitha
New User
Joined: 01 Dec 2021 Posts: 19 Location: India
|
|
|
|
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 |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
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 |
|
|
mitha
New User
Joined: 01 Dec 2021 Posts: 19 Location: India
|
|
|
|
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 |
|
|
mitha
New User
Joined: 01 Dec 2021 Posts: 19 Location: India
|
|
|
|
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 |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
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 |
|
|
mitha
New User
Joined: 01 Dec 2021 Posts: 19 Location: India
|
|
|
|
Can you explain it cleraly.Because I couldn't understand or can you share your code snippet plz to remove this |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
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 |
|
|
mitha
New User
Joined: 01 Dec 2021 Posts: 19 Location: India
|
|
|
|
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 |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
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 |
|
|
mitha
New User
Joined: 01 Dec 2021 Posts: 19 Location: India
|
|
|
|
Thank you .I completed my work |
|
Back to top |
|
|
|