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
 

 

How to redefine comp-3 variable?

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

New User


Joined: 04 Jan 2008
Posts: 15
Location: Pune

PostPosted: Fri Jan 11, 2008 3:53 pm    Post subject: How to redefine comp-3 variable?
Reply with quote

How to redefine comp-3 variable?

Suppose I have comp-3 valiable S9(11)V99 comp-3 and I have to move this value to ZZZ,ZZZ,ZZZ,ZZ9.99.So please let me know any suggestion what to do because while moving this variable i am getting S0c7 so i want to redefine ?
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Fri Jan 11, 2008 4:14 pm    Post subject:
Reply with quote

If you are getting a SOC7, that means you have non-numerics in your comp-3 variable. What you need to do is insure that you have valid data.
Back to top
View user's profile Send private message
khyati kumar

New User


Joined: 04 Jan 2008
Posts: 15
Location: Pune

PostPosted: Fri Jan 11, 2008 4:52 pm    Post subject:
Reply with quote

Actually if there is any invalid data in the comp-3 variable i want to display that variable in the control report so i am moving that variable to ZZZ,ZZZ,ZZZ,ZZ9.99.Please tell me the solution so that i can display the invalid value present in the comp-3 variable?
Back to top
View user's profile Send private message
Ajay Baghel

Active User


Joined: 25 Apr 2007
Posts: 205
Location: Bangalore

PostPosted: Fri Jan 11, 2008 5:26 pm    Post subject: Reply to: How to redefine comp-3 variable?
Reply with quote

To check for invalid packed decimal fields:

1.Use file aid and in format option mode, give the following :
NV 0

or
2. Use SORT with the below sort card:
include cond=(start position,length,PD,EQ,NUM)

This card will include only those records that have valid values in the packed numeric field indicated by the start position and length.

Thanks,
Ajay
Back to top
View user's profile Send private message
khyati kumar

New User


Joined: 04 Jan 2008
Posts: 15
Location: Pune

PostPosted: Fri Jan 11, 2008 6:05 pm    Post subject:
Reply with quote

Actually i want to write this non numeric field present in comp-3 working storage to a report file so if i am sorting it i will lose these variable.Can you please me the solution for this?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Fri Jan 11, 2008 7:19 pm    Post subject:
Reply with quote

include cond=(start position,length,PD,NE,NUM)
Back to top
View user's profile Send private message
khyati kumar

New User


Joined: 04 Jan 2008
Posts: 15
Location: Pune

PostPosted: Fri Jan 11, 2008 7:24 pm    Post subject:
Reply with quote

Thanks a Lot for your suggestion
Back to top
View user's profile Send private message
Amit Banerjee

New User


Joined: 12 Jan 2008
Posts: 14
Location: india

PostPosted: Sat Jan 12, 2008 3:10 am    Post subject: Reply to: How to redefine comp-3 variable?
Reply with quote

In the cobol program check if the value is numeric by having
IF <variable-name> IS NUMERIC
ELSE
display in your report.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sat Jan 12, 2008 3:36 am    Post subject: Re: Reply to: How to redefine comp-3 variable?
Reply with quote

Amit Banerjee wrote:
In the cobol program check if the value is numeric by having
IF <variable-name> IS NUMERIC
ELSE
display in your report.


Thats a sure way to get an 0C7.
Back to top
View user's profile Send private message
Amit Banerjee

New User


Joined: 12 Jan 2008
Posts: 14
Location: india

PostPosted: Sat Jan 12, 2008 3:54 am    Post subject:
Reply with quote

oh yes..we can't directly check an alphanumeric field for NUMERIC but I guess the packed data can be moved to a variable
VAR-1 PIC 9(11)V9(02)
VAR-2 REDEFINES VAR-1
05 VAR3 PIC X(13)

and then IF VAR-3 IS NUMERIC
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sat Jan 12, 2008 8:23 am    Post subject:
Reply with quote

Amit Banerjee wrote:
oh yes..we can't directly check an alphanumeric field for NUMERIC but I guess the packed data can be moved to a variable
VAR-1 PIC 9(11)V9(02)
VAR-2 REDEFINES VAR-1
05 VAR3 PIC X(13)

and then IF VAR-3 IS NUMERIC


var-1 is comp-3 so to redefine it var3 would be x(7) not x(13).
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 Redefine SYS1.PROCLIB farhad_evan JCL & VSAM 12 Mon May 22, 2017 10:54 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm


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