Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

moving a zero suppressed field to equivalent non-suppressed

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Kamlesh Kamal

New User


Joined: 16 May 2008
Posts: 36
Location: Kolkata,India

PostPosted: Mon Aug 03, 2009 4:30 pm    Post subject: moving a zero suppressed field to equivalent non-suppressed
Reply with quote

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
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Mon Aug 03, 2009 5:04 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Kamlesh Kamal

New User


Joined: 16 May 2008
Posts: 36
Location: Kolkata,India

PostPosted: Mon Aug 03, 2009 7:04 pm    Post subject: Reply to: moving a zero suppressed field to equivalent non-s
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Mon Aug 03, 2009 7:22 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Kamlesh Kamal

New User


Joined: 16 May 2008
Posts: 36
Location: Kolkata,India

PostPosted: Mon Aug 03, 2009 7:35 pm    Post subject: Reply to: moving a zero suppressed field to equivalent non-s
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Mon Aug 03, 2009 7:57 pm    Post subject:
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Aug 05, 2009 4:34 am    Post subject:
Reply with quote

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
View user's profile Send private message
Kamlesh Kamal

New User


Joined: 16 May 2008
Posts: 36
Location: Kolkata,India

PostPosted: Wed Aug 05, 2009 12:47 pm    Post subject: Reply to: moving a zero suppressed field to equivalent non-s
Reply with quote

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
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Wed Aug 05, 2009 1:10 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Kamlesh Kamal

New User


Joined: 16 May 2008
Posts: 36
Location: Kolkata,India

PostPosted: Wed Aug 05, 2009 1:17 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Wed Aug 05, 2009 2:46 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Wed Aug 05, 2009 4:55 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Kamlesh Kamal

New User


Joined: 16 May 2008
Posts: 36
Location: Kolkata,India

PostPosted: Wed Aug 05, 2009 5:38 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Wed Aug 05, 2009 5:48 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Wed Aug 05, 2009 5:51 pm    Post subject:
Reply with quote

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.. icon_cool.gif
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Wed Aug 05, 2009 5:53 pm    Post subject:
Reply with quote

icon_redface.gif ... Sorry Robert.. didnt see your reply...
Back to top
View user's profile Send private message
Kamlesh Kamal

New User


Joined: 16 May 2008
Posts: 36
Location: Kolkata,India

PostPosted: Wed Aug 05, 2009 6:09 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Aug 05, 2009 9:18 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 22 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Amount field is getting corrupted whe... thesumitk SYNCSORT 5 Tue Oct 18, 2016 8:20 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us