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
 

 

Special names in Cobol Code.
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
anjani shanker

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Fri Feb 29, 2008 3:17 am    Post subject: Special names in Cobol Code.
Reply with quote

Hello Everyone,

Could anyone please provide me with the details( How to Code What ) for the Special-Names in Configuration-section of Environment Division. If you can provide me with some sample codes then it would be very handy to me.


Thanks,
Anjani
Back to top
View user's profile Send private message

CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Fri Feb 29, 2008 3:31 am    Post subject:
Reply with quote

Have you looked at the examples in Describing the computing environment?
Back to top
View user's profile Send private message
anjani shanker

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Fri Feb 29, 2008 1:11 pm    Post subject:
Reply with quote

Hi,

I did go thru the link provided to me by you. Few things i could figure out and few i need to be more clear with.

1) For defining Class if "CLASS DIGIT IS "0" THROUGH "9"" is coded then while doing coding in Proc Div, if i accept a digit from in a varible, say WS-VAR and evaluate it like:

Evalaute WS-VAR
When Digit
display "Special-Names is working"
when others
go to exit-para
end-evalute.

Would this work? or do i need to still mention the 88 level definition for WS-VAR? If I need to mention the later then how can "CLASS DIGIT IS "0" THROUGH "9"" come handy.
Can you explain this with a dummy code.

2) Regarding "SYMBOLIC CHARACTERS BACKSPACE IS 23": How would this be made handy in Proc Div?

3) Also I have mentioned a stmt in special names as "Currency Sign is "*"". Now in proc div i need to display this currency sign with a var say Total.

What would be coded in Proc Div.
Is it going to be

display sign total or

display "*" total.


Thanks in advance for all d explanations comin my way. I have never worked on the Special-names things before so I need some very down to earth explations.

Anjani.
Back to top
View user's profile Send private message
anjani shanker

New User


Joined: 26 Jan 2007
Posts: 37
Location: USA

PostPosted: Sat Mar 01, 2008 7:01 am    Post subject:
Reply with quote

There might be some silly mistake in my questions that I have asked you but still I am looking forward to whatever explanations that could come my way.

Waiting for replies and icon_idea.gif for the implementing this.
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: Sat Mar 01, 2008 9:27 am    Post subject:
Reply with quote

Hello,

Quote:
Waiting for replies and icon_idea.gif for the implementing this
Unless/until you describe some requirement, i'm not sure what kind of idea(s) can be offered. The normal sequence of things is that there is a "thing to do" and then we figure out how to do it.

You have found some "solutions" and are trying to make up a "thing to do" that would need one of those solutoins.

I'd suggest you spend more time in the documentation link provided and then try a few on your system.
Back to top
View user's profile Send private message
mftrigger

New User


Joined: 18 Feb 2006
Posts: 23
Location: chennai

PostPosted: Thu Mar 06, 2008 5:41 pm    Post subject: Re: Symbolic names
Reply with quote

Anjani,

Answers for your queries:

1) WS-VAR need not be deifined as a 88 level variable. Direct checking with Digit would work ..

2) Regarding "SYMBOLIC CHARACTERS BACKSPACE IS 23".. Instead of moving 23, for readability we use BACKSPACE.

3) If u have mentioned a stmt in special names as "Currency Sign is "*"". Now in proc div u need to display this currency sign with a var say Total, then u CAN use either

display sign total or

display "*" total.
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Tue Apr 12, 2011 6:40 pm    Post subject: Reply to: Special names in Cobol Code.
Reply with quote

I need to decalre 2 special-names under configuration section. I have a requirement as below-

I have a input file and i have to validate two field of the input file.

1st Field --> X(6) --> Allowed charactors (0 to 9, B to Z)
2nd Field --> X(8) --> Allowed charactors (0 to 9, A to Z, #, @, *)

I have defined the SPECIAL-NAMES as below-- but it is giving a compile error on ALSO keyword.

Code:
 SPECIAL-NAMES.
      CLASS   WS-VALID-SEDOL IS
              'B' THRU 'I'
              'J' THRU 'R'
              'S' THRU 'Z'
              '0' THRU '9'
      CLASS   WS-VALID-CUSIP IS
              'A' THRU 'I'
              'J' THRU 'R'
              'S' THRU 'Z'
              '0' THRU '9'
              '*' ALSO '@' ALSO '#'.


WS-VALID-SEDOL is used for the validation of 1st field and
WS-VALID-CUSIP is used for the validation of 2nd field

Let me know if you need further information.
Back to top
View user's profile Send private message
mftrigger

New User


Joined: 18 Feb 2006
Posts: 23
Location: chennai

PostPosted: Tue Apr 12, 2011 7:02 pm    Post subject: Reply to: Special names in Cobol Code.
Reply with quote

Deepak,

Can u try in two ALSO lines. ..

'*' ALSO '@'
'@' ALSO '#'.

instead of

'*' ALSO '@' ALSO '#'
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Tue Apr 12, 2011 7:06 pm    Post subject:
Reply with quote

Not working! Still giving a same error...

Code:
 000048         ML0422  ,,   CLASS   WS-VALID-CUSIP IS
 000049         ML0422               'A' THRU 'I'
 000050         ML0422               'J' THRU 'R'
 000051         ML0422               'S' THRU 'Z'
 000052         ML0422               '0' THRU '9'
 000053         ML0422               '*' ALSO '@'

=000053==> IGYDS1089-S "ALSO" was invalid.  Scanning was resumed at the next
                       level-number, or the start of the next clause.

P 5655-S71 IBM Enterprise COBOL for z/OS  4.2.0               CPX010B   Date
 LineID  PL SL  ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6
 000054         ML0422               '@' ALSO '#'.
 000055         002600
 000056         002700  INPUT-OUTPUT SECTION.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Apr 12, 2011 7:25 pm    Post subject:
Reply with quote

Code:
'0' THRU '9'
  '*',  '@' .


???

you do plan on doing a byte per byte compare for the x(6) and the x(8) fileds?
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Tue Apr 12, 2011 7:38 pm    Post subject: Re: Reply to: Special names in Cobol Code.
Reply with quote

@deepak_munjal - 'ALSO' is not part of the syntax for the CLASS clause - just remove it and code (for example):
Code:
 SPECIAL-NAMES.
      CLASS   WS-VALID-SEDOL IS
              'B' THRU 'I'
              'J' THRU 'R'
              'S' THRU 'Z'
              '0' THRU '9'
      CLASS   WS-VALID-CUSIP IS
              'A' THRU 'I'
              'J' THRU 'R'
              'S' THRU 'Z'
              '0' THRU '9'
              '*' '@' '#'.


@dbzTHEdinosauer - it is not necessary to inspect the variables being tested byte-by-byte.

Code:

    IF FIRST-FIELD IS WS-VALID-SEDOL
    THEN
        do something
    ELSE
        do something else
    END-IF

    IF SECOND-FIELD IS WS-VALID-CUSIP
    THEN
        do something
    ELSE
        do something else
    END-IF
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Tue Apr 12, 2011 7:43 pm    Post subject:
Reply with quote

Yes Dick! I am doing compare byte per byte only.
Also, validation of 1st field using WS-VALID-SEDOL is working perfectly fine.

With below, no compile error but its not working fine to validate the 2nd field. I mean not considering '*' or '@' etc...

Code:
'0' THRU '9'
  '*',   '@' .
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Tue Apr 12, 2011 7:45 pm    Post subject:
Reply with quote

@Ronald.. thanks But this is also not validating the CUSIPS(2nd Field)..

Code:
      CLASS   WS-VALID-CUSIP IS
              'A' THRU 'I'
              'J' THRU 'R'
              'S' THRU 'Z'
              '0' THRU '9'
              '*' '@' '#'.
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Tue Apr 12, 2011 7:48 pm    Post subject:
Reply with quote

deepak_munjal wrote:
@Ronald.. thanks But this is also not validating the CUSIPS(2nd Field)..

Code:
      CLASS   WS-VALID-CUSIP IS
              'A' THRU 'I'
              'J' THRU 'R'
              'S' THRU 'Z'
              '0' THRU '9'
              '*' '@' '#'.


What do you mean, exactly, that the given CLASS is not validating the CUSIPS field?

What is the CODE (statement or statements) that you are using to validate the field?

What is the exact value of the field that you state is "not validating"?
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Tue Apr 12, 2011 7:55 pm    Post subject:
Reply with quote

Yes, WS-VALID-CUSIP is not validating the CUSIP and process goes down with SOC7. It should go to end-para. And then read and process th next CUSIP and so on.. Validation process is same for 1st field (SEDOL) also which is working fine.

Value of the CUSIP Field is
Code:
T1@88A11


Code statement are-

Code:
  MOVE 1 TO COUNTR1.
      PERFORM UNTIL COUNTR1 = 8
        IF RU-CUSIP(COUNTR1:1) IS NOT WS-VALID-CUSIP
          DISPLAY 'INVALID CUSIP ' RU-CUSIP-CUSIP
          SET INVALID-KEY TO TRUE
          GO TO 1200-EXIT
        ELSE
          ADD 1 TO COUNTR1
        END-IF
      END-PERFORM
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Tue Apr 12, 2011 8:12 pm    Post subject:
Reply with quote

It is not clear from the code presented why you might be abending with a S0C7. However two things should be noted:
1) As I stated earlier, you do NOT have to examine the test-field byte-by-byte. If the field being tested is invalid if it contains ANY character other than those specified in the CLASS being applied, then the entire field can be validated at once - e.g.
Code:

   IF RU-CUSIP IS NOT WS-VALID-CUSIP
      DISPLAY 'INVALID CUSIP ' RU-CUSIP
      SET INVALID-KEY TO TRUE
      GO TO 1200-EXIT
   END-IF

2) The PERFORM, as coded, would only validate the first SEVEN bytes of the RU-CUSIP field, not all EIGHT bytes (The test for the UNTIL condition is (by default) done BEFORE the PERFORM logic is executed - unless you specify WITH TEST AFTER). If you insist on validating the field byte-by-byte, then the PERFORM should be done until COUNTR1 is GREATER than 8, not EQUAL TO 8.
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Tue Apr 12, 2011 8:42 pm    Post subject:
Reply with quote

Thanks for the above 2 changes..
I have made the change and its working fine.

but still strugling with validation of 2nd Field(CUSIP)..
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Tue Apr 12, 2011 8:45 pm    Post subject:
Reply with quote

Do you know if CLASS allow these special characters #, @, * etc.. ?
If not how i can define a data-type field which includes these special characters..
I checked in the some PPTs but didn't get the desired solution..
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Tue Apr 12, 2011 9:09 pm    Post subject:
Reply with quote

Yes, the CLASS clause allows for any of the 256 possible EBCDIC character values.

Please show the code line defining RU-CUSIP

and try the following
Code:
   IF RU-CUSIP IS NOT WS-VALID-CUSIP
   THEN
      DISPLAY 'RU-CUSIP ' RU-CUSIP ' IS NOT VALID'
      SET INVALID-KEY TO TRUE
      GO TO 1200-EXIT
   ELSE
      DISPLAY 'RU-CUSIP ' RU-CUSIP ' IS VALID'
   END-IF


and paste the results.
Back to top
View user's profile Send private message
deepak_munjal

New User


Joined: 30 May 2008
Posts: 43
Location: Mumbai

PostPosted: Wed Apr 13, 2011 1:24 am    Post subject: Reply to: Special names in Cobol Code.
Reply with quote

@Ronald... I checked this number of times...
It is not validating when any of the case incurred i.e. @, # or *.
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am


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