Mistakes new programmers doing in start of the career?

Other Mainframe related questions which attracts you and there is no suitable Forum you find for it and related FAQs.
Previous topicNext topic

Topic Author
Kishor Sonawane
Registered Member
Posts: 23
Joined: Thu Nov 21, 2013 3:25 pm

Mistakes new programmers doing in start of the career?

Post by Kishor Sonawane » Tue Apr 04, 2017 2:28 pm

Hi,

As a COBOL experience programmer, if you have to tell a new programmer that what are the mistakes you see new programmers are doing when they start their career, what will be your piece of advice on that. Please share your views on this, it might help some of us.




nicc
Global Moderator
Global Moderator
Posts: 595
Joined: Wed Apr 23, 2014 8:45 pm

Re: Mistakes new programmers doing in start of the career?

Post by nicc » Tue Apr 04, 2017 3:55 pm

Read the manuals. The reference for the language in question and the user guide for it.


Regards
Nic

User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1376
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: Mistakes new programmers doing in start of the career?

Post by Robert Sample » Tue Apr 04, 2017 5:24 pm

One thing I repeatedly stress to my programmers (whether new or old) is that the S0C7 Data Exception is a programmer error, not a program error. With defensive coding techniques, it is possible for a programmer to totally prevent S0C7 ABENDS.




Topic Author
Kishor Sonawane
Registered Member
Posts: 23
Joined: Thu Nov 21, 2013 3:25 pm

Re: Mistakes new programmers doing in start of the career?

Post by Kishor Sonawane » Thu Feb 01, 2018 10:26 am

Thanks nicc and Robert.

But if you don't have control on the data of input file, can then be S0C7 prevented?



User avatar

prino
Registered Member
Posts: 61
Joined: Sun Jun 01, 2014 4:15 am
Location: Oostende, Belgium
Zodiac: Pisces

Re: Mistakes new programmers doing in start of the career?

Post by prino » Thu Feb 01, 2018 4:32 pm

Kishor Sonawane wrote:
Thu Feb 01, 2018 10:26 am
But if you don't have control on the data of input file, can then be S0C7 prevented?
Robert Sample wrote:
Tue Apr 04, 2017 5:24 pm
With defensive coding techniques, it is possible for a programmer to totally prevent S0C7 ABENDS.
Biggest mistake? Not reading replies!


Robert AH Prins
robertahprins @ the.17+Gb.Google thingy
Some z/OS code here

User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1376
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: Mistakes new programmers doing in start of the career?

Post by Robert Sample » Thu Feb 01, 2018 6:41 pm

But if you don't have control on the data of input file, can then be S0C7 prevented?
Yes, of course it can be done. Verify that each numeric field is numeric before using it in calculations. Use REDEFINES if necessary on numeric fields to have an alphanumeric (PIC X) variable to be able to check each character (not always needed but handy in some cases). The specifics will depend upon the data and how it is generated, but it is ENTIRELY possible to prevent every S0C7 ABEND by appropriate coding.




zprogrammer
Global Moderator
Global Moderator
Posts: 605
Joined: Wed Nov 20, 2013 11:53 am
Location: Mars
Zodiac: Libra

Re: Mistakes new programmers doing in start of the career?

Post by zprogrammer » Fri Feb 02, 2018 12:47 am

I generally ask my trainees to create new mistakes while you learn so you remember how to fix them in real time.

[ Post made via Android ] Image


zprogrammer

User avatar

vasanthz
Registered Member
Posts: 23
Joined: Tue Dec 06, 2016 1:06 am

Re: Mistakes new programmers doing in start of the career?

Post by vasanthz » Tue Feb 06, 2018 12:49 am

Learning how to use the manuals(usually user guide) for a product/programming language is very important.

I think most new programmers including myself always stay away from reading manuals during the start of the career. Yes it is daunting to go through 200 page PDF to find a solution to a problem, but this is the first obstacle to overcome & an important one.

Also when asking for help, one would get better response if they provide what they have tried so far and
where they are stuck. It shows that the TS has made an effort and not trying to free load on other people's effort.


Regards,
Vasanth.S

User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1376
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: Mistakes new programmers doing in start of the career?

Post by Robert Sample » Tue Feb 06, 2018 3:10 am

I generally ask my trainees to create new mistakes while you learn so you remember how to fix them in real time.
In one of my college classes, the professor had us code programs to generate as many errors as possible in as few lines as possible. It was an interesting exercise!




Topic Author
Kishor Sonawane
Registered Member
Posts: 23
Joined: Thu Nov 21, 2013 3:25 pm

Re: Mistakes new programmers doing in start of the career?

Post by Kishor Sonawane » Wed Feb 07, 2018 2:42 pm

Robert Sample wrote:
Thu Feb 01, 2018 6:41 pm
Yes, of course it can be done. Verify that each numeric field is numeric before using it in calculations. Use REDEFINES if necessary on numeric fields to have an alphanumeric (PIC X) variable to be able to check each character (not always needed but handy in some cases). The specifics will depend upon the data and how it is generated, but it is ENTIRELY possible to prevent every S0C7 ABEND by appropriate coding.
Thanks Robert. But will it not be better to get the data itself corrected instead of adding many lines of codes?

Now I understand what you were saying as defensive techniques.




Topic Author
Kishor Sonawane
Registered Member
Posts: 23
Joined: Thu Nov 21, 2013 3:25 pm

Re: Mistakes new programmers doing in start of the career?

Post by Kishor Sonawane » Wed Feb 07, 2018 2:44 pm

zprogrammer wrote:
Fri Feb 02, 2018 12:47 am
I generally ask my trainees to create new mistakes while you learn so you remember how to fix them in real time.
Thanks.



User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1376
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: Mistakes new programmers doing in start of the career?

Post by Robert Sample » Wed Feb 07, 2018 6:14 pm

But will it not be better to get the data itself corrected instead of adding many lines of codes?
Yes, that is the preferred solution. However, there are many cases where it simply is not possible (for example, the data comes from another company and that company indicates they will not, under any circumstances, change the data they are providing).



User avatar

prino
Registered Member
Posts: 61
Joined: Sun Jun 01, 2014 4:15 am
Location: Oostende, Belgium
Zodiac: Pisces

Re: Mistakes new programmers doing in start of the career?

Post by prino » Sat Feb 10, 2018 12:48 am

Robert Sample wrote:
Tue Feb 06, 2018 3:10 am
I generally ask my trainees to create new mistakes while you learn so you remember how to fix them in real time.

In one of my college classes, the professor had us code programs to generate as many errors as possible in as few lines as possible. It was an interesting exercise!
Then this four-line PL/I program is likely a decent candidate for a medal:

Code: Select all

%dcl z%z='put edit';proc options(main;q=''''put list(m;do i=1,2;z(q)skip;do j=         
1to 78c=substr(m(i),j;if c=q z(c;z(c;end;z(q',';dcl(c,q)char,m(2)char(99)init(         
'%dcl z%z=''put edit'';proc options(main;q=''''''''put list(m;do i=1,2;z(q)skip;do j=',
'1to 78c=substr(m(i),j;if c=q z(c;z(c;end;z(q'','';dcl(c,q)char,m(2)char(99)init(',    
As it generates the following messages, using the old V2.3.0 OS PL/I compiler:

Code: Select all

15668-910 IBM OS PL/I OPTIMIZING COMPILER %dcl z%z='put edit';proc options(main;q=''''put list(m;do i=1,2;z(q)skiPAGE   2
-PREPROCESSOR DIAGNOSTIC MESSAGES
-ERROR ID L   LINE    MESSAGE DESCRIPTION
0
0SEVERE AND ERROR DIAGNOSTIC MESSAGES
0
0IEL0133I E   1       MISSING SEMICOLON ASSUMED BEFORE '%'.
0IEL0163I E   1       NO ATTRIBUTES DECLARED FOR IDENTIFIER 'Z'.    'CHARACTER' ASSUMED.
0
0END OF PREPROCESSOR DIAGNOSTIC MESSAGES

Code: Select all

15668-910 IBM OS PL/I OPTIMIZING COMPILER %dcl z%z='put edit';proc options(main;q=''''put list(m;do i=1,2;z(q)skiPAGE   6
-COMPILER DIAGNOSTIC MESSAGES
-ERROR ID L   STMT    MESSAGE DESCRIPTION
0
0SEVERE AND ERROR DIAGNOSTIC MESSAGES
0
0IEL0241I S           END OF SOURCE TEXT FOUND BEFORE LOGICAL END OF PROGRAM.    2 'END' STATEMENT(S) ASSUMED.
0IEL0285I S   1       LABEL MISSING FROM 'PROCEDURE' OR 'ENTRY' STATEMENT.    ONE HAS BEEN ASSUMED.
0IEL0400I E   1       RIGHT PARENTHESIS ASSUMED AFTER 'OPTIONS(MAIN'.
0IEL0399I E   2       SEMICOLON ASSUMED AFTER 'OPTIONS(MAIN;Q='''''.
0IEL0400I E   3       RIGHT PARENTHESIS ASSUMED AFTER 'LIST(M'.
0IEL0306I S   5       EDIT DATA LIST HAS NO MATCHING FORMAT LIST AFTER 'EDIT(Q)'.    'A' FORMAT ASSUMED.
0IEL0399I E   6       SEMICOLON ASSUMED AFTER '(Q)SKIP;DO J= 1TO 78'.
0IEL0400I E   7       RIGHT PARENTHESIS ASSUMED AFTER 'TO 78C=SUBSTR(M(I),J'.
0IEL0271I S   8       KEYWORD 'THEN' ASSUMED AFTER 'UBSTR(M(I),J;IF C=Q' IN 'IF' STATEMENT.
0IEL0306I S   8       EDIT DATA LIST HAS NO MATCHING FORMAT LIST AFTER 'EDIT(C'.    'A' FORMAT ASSUMED.
0IEL0400I E   8       RIGHT PARENTHESIS ASSUMED AFTER 'EDIT(C'.
0IEL0306I S   9       EDIT DATA LIST HAS NO MATCHING FORMAT LIST AFTER 'EDIT(C'.    'A' FORMAT ASSUMED.
0IEL0400I E   9       RIGHT PARENTHESIS ASSUMED AFTER 'EDIT(C'.
0IEL0306I S   11      EDIT DATA LIST HAS NO MATCHING FORMAT LIST AFTER 'EDIT(Q',''.    'A' FORMAT ASSUMED.
0IEL0362I E   11      COMMA ASSUMED AFTER 'EDIT(Q'.
0IEL0400I E   11      RIGHT PARENTHESIS ASSUMED AFTER 'EDIT(Q',''.
0IEL0314I S   12      END OF SOURCE TEXT FOUND BEFORE END OF STATEMENT.    ',' IGNORED.
0IEL0400I E   12      RIGHT PARENTHESIS ASSUMED AFTER 'r,m(2)char(99)init(''.
0
0WARNING DIAGNOSTIC MESSAGES
0
0IEL0563I W           STATEMENT NUMBER / LEVEL / NEST DETAILS MAY BE INCOMPLETE IN SOURCE LISTING DUE TO PREVIOUSLY
                      DETECTED INVALID SYNTAX.
0IEL0563I W           STATEMENT NUMBER / LEVEL / NEST DETAILS MAY BE INCOMPLETE IN SOURCE LISTING DUE TO PREVIOUSLY
                      DETECTED INVALID SYNTAX.
0IEL0254I W   2       NO BLANK BETWEEN CONSTANT AND FOLLOWING LETTER.    BLANK ASSUMED AFTER 'OPTIONS(MAIN;Q='''''.
0IEL0254I W   6       NO BLANK BETWEEN CONSTANT AND FOLLOWING LETTER.    BLANK ASSUMED AFTER '(Q)SKIP;DO J= 1TO 78'.
0IEL0254I W   6       NO BLANK BETWEEN CONSTANT AND FOLLOWING LETTER.    BLANK ASSUMED AFTER 'EDIT(Q)SKIP;DO J= 1'.
0IEL0238I W   12, 12    CHARACTER STRING CONSTANT CONTAINS SEMICOLON.
0
0COMPILER INFORMATORY MESSAGES
0
0IEL0533I I           NO 'DECLARE' STATEMENT(S) FOR 'SYSPRINT','SUBSTR','I','J'.
0IEL0541I I   1       'ORDER' OPTION APPLIES TO THIS BLOCK.    OPTIMIZATION MAY BE INHIBITED.
0
0END OF COMPILER DIAGNOSTIC MESSAGES
However...

Despite the presence of no less than 8 S (RC=12) and 10 E (RC=08) errors, it still produces a valid OBJECT deck, that, when linked, produces a valid LOAD module that prints the original source. Yes, the above is (probably, I'd like to be proved incorrect, as I wrote it) the smallest (326 significant bytes) possible PL/I Quine


Robert AH Prins
robertahprins @ the.17+Gb.Google thingy
Some z/OS code here

Previous topicNext topic

Return to “Other Mainframe Topics, Off-Topics, FAQs.”