IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Special names in Cobol Code.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 2146
Location: At my coffee table

PostPosted: Fri Feb 29, 2008 3:31 am
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
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
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

Moderator Emeritus


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

PostPosted: Sat Mar 01, 2008 9:27 am
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Ronald Burr

Active User


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

PostPosted: Wed Apr 13, 2011 1:49 am
Reply with quote

You are either not following the code I suggested or are not telling us everything we need to know about your code. I compiled and executed the following program:
Code:
       IDENTIFICATION DIVISION.                           
       PROGRAM-ID. SPECIAL.                               
       ENVIRONMENT DIVISION.                               
       CONFIGURATION SECTION.                             
       SOURCE-COMPUTER. IBM-370.                           
       SPECIAL-NAMES.                                     
           CLASS WS-VALID-CUSIP IS                         
                 '@' '#' '*'                               
                 'A' THRU 'I'                             
                 'J' THRU 'R'                             
                 'S' THRU 'Z'                             
                 '0' THRU '9'.                             
       DATA DIVISION.                                     
       WORKING-STORAGE SECTION.                           
       01  WS-CUSIP        PIC X(8).                       
       PROCEDURE DIVISION.                                 
           MOVE 'ABJKST01' TO WS-CUSIP                     
           PERFORM VALIDATE-CUSIP                         
           MOVE 'CDLMUV23' TO WS-CUSIP                     
           PERFORM VALIDATE-CUSIP                         
           MOVE 'EFNOWX45' TO WS-CUSIP                     
           MOVE 'GHPQYZ67' TO WS-CUSIP                     
           PERFORM VALIDATE-CUSIP                         
           MOVE 'IJRSAB89' TO WS-CUSIP                     
           PERFORM VALIDATE-CUSIP                         
           MOVE 'KLTUCD@#' TO WS-CUSIP                     
           PERFORM VALIDATE-CUSIP                         
           MOVE 'MNVWEF#*' TO WS-CUSIP                     
           PERFORM VALIDATE-CUSIP                         
           MOVE '@#*@#*@#' TO WS-CUSIP                     
           PERFORM VALIDATE-CUSIP                         
           MOVE 'IM SPACE' TO WS-CUSIP                     
           PERFORM VALIDATE-CUSIP                         
           MOVE 'PERCENT%' TO WS-CUSIP                     
           PERFORM VALIDATE-CUSIP                         
           GOBACK.                                         
       VALIDATE-CUSIP.                                     
           IF WS-CUSIP IS NOT WS-VALID-CUSIP               
           THEN                                           
              DISPLAY 'WS-CUSIP >' WS-CUSIP '< IS NOT VALID.'
           ELSE                                           
              DISPLAY 'WS-CUSIP >' WS-CUSIP '< IS VALID.'   
           END-IF.


and the SYSOUT from execution was:

Code:
WS-CUSIP >ABJKST01< IS VALID.   
WS-CUSIP >CDLMUV23< IS VALID.   
WS-CUSIP >EFNOWX45< IS VALID.   
WS-CUSIP >GHPQYZ67< IS VALID.   
WS-CUSIP >IJRSAB89< IS VALID.   
WS-CUSIP >KLTUCD@#< IS VALID.   
WS-CUSIP >MNVWEF#*< IS VALID.   
WS-CUSIP >@#*@#*@#< IS VALID.   
WS-CUSIP >IM SPACE< IS NOT VALID.
WS-CUSIP >PERCENT%< IS NOT VALID.


As you can see, the code I suggested works perfectly.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Apr 13, 2011 2:05 am
Reply with quote

Deepak,

you were asked to perform a simple coding change and paste the result.
all you give us is
Quote:

@Ronald... I checked this number of times...


There have been other threads over the last couple of days that have alluded to the 'heavy handed' way in which we respond.

Most of the members who make suggestions and request info,
do it for a reason:
  • They are experienced professionals
  • who realize that lack of precision is the reason for most errors
  • and know that if something is not working properly
  • it is due to the rooky's lack of attention to detail
  • we are receiving nothing from you except your opinion and observations
  • which if were worth anything
  • you would not have posted such a beginners problem in this forum.

if you would bother to following suggested instructions
for once

you may eventually solve your problem.

most of the senior members have learned
how to use instructions based on trial and error
until they managed to find the answer.

When we were learning, there was no internet.
Our seniors would be angry that we would not bother to figure things out on our own.

You coded something up, ran it and said:
oooww, iiiiitttt doosssssent work!
and when someone, attempting to help you, suggests something,
you ignore the request and again say,
ooowwwww, poooorrrr meeee, iiitt dooosssent work
something is wrong with the compiler.

either figure it out on your own,
or do exactly what people ask.

they are trying to discover what stupid, rookie thing you are doing
so that you will see your error or we can and then provide you with some eduction.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Apr 13, 2011 2:09 am
Reply with quote

Ronald,
I expect Deepak will respond with:
"
that is the same way I coded it, but it doesn't work
maybe something is wrong with our operating system,
sure could not be me....
"
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8651
Location: Dubuque, Iowa, USA

PostPosted: Wed Apr 13, 2011 2:14 am
Reply with quote

Quote:
maybe something is wrong with our operating system,
sure could not be me....
I lost count (it was well over 100 at that time) quite a few years ago of how many times programmers told me the system wasn't working right because their program just had to be running correctly. The tally so far: system 2, programmers N-2. Both issues were very specific and had fixes provided by IBM after we opened the PMR on them. I don't think we're going to find the third occurrence in this thread, either. In other words, Deepak, the odds are well over 100 to 1 that the problem is with your code, not the system.
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: Wed Apr 13, 2011 2:35 am
Reply with quote

In over 40 YEARS of mainframe programming, I have personally encountered TWO (count 'em, 2) problems that were directly related to SYSTEM software.
The first was a very specific COBOL program that, when compiled and executed (on an IBM 360 mod 30, if I remember correctly), sucked the internal reader dry - meaning that every job in the queue "disappeared". My job was cancelled - and upon resubmission, did the same exact thing. At a loss, we re-arranged several of the elements in Working-Storage, and swapped the location of a couple of PERFORMED Paragraphs and voila! the program worked just fine. We chalked the problem up to a one-in-a-million page boundary problem of some sort. Never saw anything like it again.
The second problem was an IBM VS-COBOL subroutine that was called to handle the multiplication of two large numbers. It didn't calculate the result correctly. I dissassembled the subroutine, found the error, fixed it (in my private library), and re-ran with a STEPLIB and it worked fine. I notified IBM of the problem (and the fix), and they did eventually sent out a PTF (about 3-months later).

So far, SYSTEM: 2, RON: N-2. Sounds like an echo in here, in here.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Cobol prog to put an indicator on the... JCL & VSAM 1
No new posts COBOL Ascending and descending sort n... COBOL Programming 5
No new posts Help needed to assemble IMS sample co... ABENDS & Debugging 4
No new posts COBOL program logic for comparisipn o... COBOL Programming 2
No new posts COBOL - create and write to output fi... COBOL Programming 0
Search our Forums:

Back to Top