View previous topic :: View next topic
|
Author |
Message |
Kamlesh Kamal
New User
Joined: 16 May 2008 Posts: 36 Location: Kolkata,India
|
|
|
|
Hi ,
I have an input file in which the values are zero suppressed.for example I have a filed amount1 with data type as PIC ------9.99.I need to move this to a new field and check if this is NON-ZERO after which I will do some prossessing over it .Can anyone tell me how it can be done.
I have tried the following.
1)moving it to PIC S9(5)V9(2) USAGE COMP-3. ann got an error like "An invalid sign was detected in a numeric edited sending field "
2)tried using the field PIC ------9.99 directly but the check of NOT EQUAL TO 0 didn't work |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
I defined variables
Code: |
01 WS-TEST.
05 WS-TEST-1 PIC -----9.99.
05 WS-TEST-2 PIC 9(05)V9(02). |
with code of
Code: |
MOVE 12.34 TO WS-TEST-1.
MOVE WS-TEST-1 TO WS-TEST-2.
DISPLAY 'WS-TEST-1 ' WS-TEST-1.
DISPLAY 'WS-TEST-2 ' WS-TEST-2.
MOVE -12.34 TO WS-TEST-1.
MOVE WS-TEST-1 TO WS-TEST-2.
DISPLAY 'WS-TEST-1 ' WS-TEST-1.
DISPLAY 'WS-TEST-2 ' WS-TEST-2. |
and got results of
Code: |
WS-TEST-1 12.34
WS-TEST-2 0001234
WS-TEST-1 -12.34
WS-TEST-2 0001234 |
So you need to provide additional details. Which compiler are you using? What is the value that is generating the error message? |
|
Back to top |
|
|
Kamlesh Kamal
New User
Joined: 16 May 2008 Posts: 36 Location: Kolkata,India
|
|
|
|
I have the input file which has a field
WS-STI-SALES-SERVICE-FEE PIC ------9.99.
As you mentioned i have a working storage field as
01 WS-STI-SALES-SERVICE-FEE1 PIC 9(6)V9(2) USAGE COMP-3.
After reading the file I am giving a
MOVE WS-STI-SALES-SERVICE-FEE
TO WS-STI-SALES-SERVICE-FEE1
now when I am checking
IF (WS-STI-SALES-SERVICE-FEE1 NOT EQUAL TO 0 ---> I am getting a soc 7 here....plz suggect.. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Change your IF statement to
Code: |
IF WS-STI-SALES-SERVICE-FEE1 NOT NUMERIC
DISPLAY <message and data value>
ELSE
IF WS-STI-SALES-SERVICE-FEE1 NOT EQUAL TO 0
.
.
.
|
An S0C7 abend means the data is not numeric. So either your compiler is so old it does not support de-editing data values (which cannot be proved nor disproved by what you're posted since you did not tell us which compiler you're using -- and the top of every page of compiler output tells you the compiler and version), or you truly do not have valid data in the source field (which again cannot be proved nor disproved since you did not provide any output showing the value -- even data from the dump would be helpful). |
|
Back to top |
|
|
Kamlesh Kamal
New User
Joined: 16 May 2008 Posts: 36 Location: Kolkata,India
|
|
|
|
Hi,
Thanks again..
the data is numeric actually..
here is the screenshot of my spool output.i can't find any other way of showing it to u than the screenshot.hope u r able to see it
The compiler is COBOLENT I GUESS.. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
1. Learn to use BBcode -- not everybody here can look at attachments.
2. When you compile your program, the very first line that will show up will be something like
Code: |
1PP 5655-G53 IBM Enterprise COBOL for z/OS 3.4.1 |
which indicates the compiler and version. What you put in the attachment is run time output, not compile output -- totally useless for what I asked.
3. The S0C7 abend can be precisely identified. Run a compile using LIST,NOOFFSET and the offsets for every line of your program will be produced as part of your compile output. Those offsets can then be used to pinpoint exactly which line -- and COBOL verb -- where your S0C7 abend occurred. You are telling us the line that abends without showing anything that indicates this. Without proof that what you are saying is where the actual abend is, there's not going to be much more that we can do for you. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
You 1st said:
Quote: |
1)moving it to PIC S9(5)V9(2) USAGE COMP-3. ann got an error like "An invalid sign was detected in a numeric edited sending field " |
Then in your next post you said:
Quote: |
MOVE WS-STI-SALES-SERVICE-FEE
TO WS-STI-SALES-SERVICE-FEE1
now when I am checking
IF (WS-STI-SALES-SERVICE-FEE1 NOT EQUAL TO 0 ---> I am getting a soc 7 here....plz |
wihich indicates that the move was successful. Why is that? How can that be? |
|
Back to top |
|
|
Kamlesh Kamal
New User
Joined: 16 May 2008 Posts: 36 Location: Kolkata,India
|
|
|
|
Hi Jack,
Yea..first time when I moved the filed to a S9(5)V9(2) USAGE COMP-3 field I got an error with this MOVE
Afterwords I moved it to just an 9(5)V9(2) USAGE COMP-3 and that error was not there but when I was checking on that particular field for IF (WS-STI-SALES-SERVICE-FEE1 NOT EQUAL TO 0 I was getting a SOC 7.
Robert,
If you are still following up on this tag:
I mentioned that I was getting a soc 7 in that particular statement I did lok into the line number using the offset that I got in my sysout.
The SOC7 was resolved using your suggestion of checking for NOT NUMERIC clause.But the problem is that I am skipping now few records for which I have values like spaces follwed by lets say 123.12.
But I need to capture these amount fileds as well.I tried replacing the spaces by zeroes using INSPECT over it but that gave an error as INSPECT is perhaps not allowed on a COMP 3 fileld.
As for compiler info I am using CHANGEMAN for compilation and link edit the version is IBM Enterprise COBOL for z/OS 3.4.1
Once again here is my requirement:
Read an input file
get the amounts therein per record check for certain conditions-- including if amount is non-zero --and populate it in a file .After which I have to sort and roll up those amounts fields in a report that is to be generated.
The problem really was that the I/P file is having all the amount fileds as zero supressed.That meant checking for non-zero was skipping records as the amounts fields were starting with spaces and it was no longer a numeric field.I don't know why spaces are still there even after I am moving the fileds to a COMP3 field.
Can you let me know what to do now.Is there any way perhaps we can have a short talk over this if I am unable to make myself clear? |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Kamlesh,
Probably a sample of the input file, especially the records which is getting skipped, would help us to understand better. |
|
Back to top |
|
|
Kamlesh Kamal
New User
Joined: 16 May 2008 Posts: 36 Location: Kolkata,India
|
|
|
|
Hi Binop,
For example this is the record which is getting skipped
Code: |
WS-STI-MISC-COMP WS-STI-COGS-FEE WS-STI-PC-AGENT-PMT WS-STI-PREF-BROKER-FEES
10/AN 10/AN 10/AN 10/AN
(1980-1989)R (1990-1999)R (2000-2009)R (2010-2019)R
161------------- 162------------ 163---------------- 164--------------------
********************************* TOP OF DATA **********************-CAPS OF
0.00 275.36 0.00 0.00 |
As the number 275.36 IS preceeded with spaces and is getting skipped with NON-NUMERIC check |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Kamlesh,
I tested the same in my system and seems to be working fine.
Code: |
05 WS-TEST-1 PIC -----9.99.
05 WS-TEST-1-R REDEFINES WS-TEST-1
PIC X(09).
05 WS-TEST-2 PIC 9(05)V9(02) USAGE COMP-3.
MOVE ' 275.36' TO WS-TEST-1-R.
MOVE WS-TEST-1 TO WS-TEST-2.
IF WS-TEST-2 NOT NUMERIC
DISPLAY 'NOT NUMERIC'
ELSE
IF WS-TEST-2 NOT EQUAL TO ZERO
DISPLAY 'TO BE WRITTEN ... '
DISPLAY WS-TEST-2
END-IF
END-IF.
Output :
TO BE WRITTEN ...
0027536 |
Please do correct me if I have given anything wrong. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
Kamlesh, I think things are quite clear. Multiple people, including me, have posted code that proves what you are telling us does not happen in COBOL 3.4.1 -- so either you're not telling us everything, or you're not doing what you tell us you are doing. COBOL 3.4.1 de-edits data fields, converting leading spaces to zeroes, and processes the numeric value out of a PIC -----9.99 field with no problems -- as has been proved twice in posts. Unless you post the exact code (variable definitions as well as PROCEDURE DIVISION statements) that you are using, I don't think we can help you any further. We have posted code showing exactly what COBOL does and that conflicts with what you are saying. |
|
Back to top |
|
|
Kamlesh Kamal
New User
Joined: 16 May 2008 Posts: 36 Location: Kolkata,India
|
|
|
|
Hi Robert/Binop,
Thanks a lot for all your help.I got it through finally.
I got the file generated and rolled up .Now it looks like
Code: |
2860000073 ......éè* .........
6111002650 ......... ........@
6131000200 .......-. .........
6141002010 ....lÈ... .....m.Ä@
6141002060 .....lf-% .....ä.ì.
6161000400 ......ØÑð ...... .@
6161000410 .....øáÈ@ ......ååð
6161000600 ....p-... ....ã°.À.
6161009990 ......íÈ. ..... Ï..
6164000050 ......Áj. .......Å*
6275000100 ........" ........¤
6461000500 .......-. ........|
6691000030 .......d< ......Ã/%
6691002000 .......-. ........|
6693000020 .......-. .........
6702000240 ........ð ........@
6963002000 ......... ........% |
Now my requirement is to convert this file into a report format converting these comp3 fields to display format.I can do it using one more cobol program but is there any way It can be done using the JCl itself.
The report will have a header and a trailer and the column names as well.Is it possible to achive it through JCl only |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
JCL executes programs. It does not change files, it does not convert fields, it does nothing but execute programs. If you want to use SORT to do this -- SORT is a program! If you want to use COBOL to do this -- you're using a program! So tell us which utility or program you wish to use and advice will be available.
However, as your problem is stated it cannot be done since JCL cannot do anything but execute programs. |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Kamlesh
Quote: |
Thanks a lot for all your help.I got it through finally |
Glad that we could be of help. I would like to mention that it would be nice from your part if you could update us on how u corrected the issue.
Quote: |
Now my requirement is to convert this file into a report format converting these comp3 fields to display format.I can do it using one more cobol program but is there any way It can be done using the JCl itself. |
The same can be using SYNCSORT or ICETOOL. I am sure you will find various topics already discussed.
*Please Note : JCL itself doesn't do anything... its just a control language. also probably having a new topic for a new "requirement"would be better rather than continuing from the same.. |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
... Sorry Robert.. didnt see your reply... |
|
Back to top |
|
|
Kamlesh Kamal
New User
Joined: 16 May 2008 Posts: 36 Location: Kolkata,India
|
|
|
|
What I had meant was is there any way apart from writting a COBOL pgm.Like EASYTRIEVE perhaps to acheive what I require.
Or else is there any way I can sort and roll up fields which are in display format in a file.
Code: |
6141002060 000000000000275.36
6141002060 000000000000275.36
6141002060 000000000000275.36
6141002060 000000000000275.36
6141002060 000000000000275.36
6141002010 000000000000275.36
6161000600 000000000000081.64
6141002010 000000000000081.64
6161000600 000000000000081.64
6161000600 000000000000081.64
6161000600 000000000000081.64 |
The data types are
Code: |
PEOSFT-ACCT PIC 9(10).
FILLER PIC X(8) VALUE SPACES.
FCAE-TRAN-AMT-REL1 PIC 9(15).9(2). |
The requirement is to have one unique record per PEOSFT-ACCT |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I got the file generated and rolled up .Now it looks like
Code: |
2860000073 ......éè* .........
6111002650 ......... ........@
.
. |
|
You might use this version of the file as input to your Easytrieve. . . |
|
Back to top |
|
|
|