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.
Post Reply
Kishor Sonawane
Registered Member
Posts: 24
Joined: Thu Nov 21, 2013 3:25 pm

Mistakes new programmers doing in start of the career?

Post by Kishor Sonawane »

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: 691
Joined: Wed Apr 23, 2014 8:45 pm

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

Post by nicc »

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: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post by Robert Sample »

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.
Kishor Sonawane
Registered Member
Posts: 24
Joined: Thu Nov 21, 2013 3:25 pm

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

Post by Kishor Sonawane »

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: 68
Joined: Sun Jun 01, 2014 4:15 am
Location: Vilnius, Lithuania
Contact:

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

Post by prino »

Kishor Sonawane wrote: Thu Feb 01, 2018 10:26 amBut 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 pmWith 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: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post by Robert Sample »

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: 588
Joined: Wed Nov 20, 2013 11:53 am
Location: Mars

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

Post by zprogrammer »

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: 32
Joined: Tue Dec 06, 2016 1:06 am

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

Post by vasanthz »

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: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post by Robert Sample »

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!
Kishor Sonawane
Registered Member
Posts: 24
Joined: Thu Nov 21, 2013 3:25 pm

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

Post by Kishor Sonawane »

Robert Sample wrote: Thu Feb 01, 2018 6:41 pmYes, 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.
Kishor Sonawane
Registered Member
Posts: 24
Joined: Thu Nov 21, 2013 3:25 pm

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

Post by Kishor Sonawane »

zprogrammer wrote: Fri Feb 02, 2018 12:47 amI 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: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post by Robert Sample »

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: 68
Joined: Sun Jun 01, 2014 4:15 am
Location: Vilnius, Lithuania
Contact:

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

Post by prino »

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
Kishor Sonawane
Registered Member
Posts: 24
Joined: Thu Nov 21, 2013 3:25 pm

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

Post by Kishor Sonawane »

PL/I is not used much these days, is not it? It has become a rare language these days.
User avatar
mstam
New Member
Posts: 2
Joined: Mon Jan 18, 2021 3:36 pm

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

Post by mstam »

Thank you for an interesting thread. @Robert Sample: the craft of definsive design is not technology specific, however courses or online traning material is typically using a contemporay language. That is not too inspiring for a seasoned PL1 programmer who is in the need of inspiration. Can you (Robert or anyone) help pointing to some (good) material that can be used as inspiration? Thank you in advance.
User avatar
DB2 Guy
Forum Moderator
Forum Moderator
Posts: 119
Joined: Sun Apr 21, 2013 8:25 pm
India

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

Post by DB2 Guy »

mstam wrote: Mon Jan 18, 2021 3:59 pm Thank you for an interesting thread. @Robert Sample: the craft of definsive design is not technology specific, however courses or online traning material is typically using a contemporay language. That is not too inspiring for a seasoned PL1 programmer who is in the need of inspiration. Can you (Robert or anyone) help pointing to some (good) material that can be used as inspiration? Thank you in advance.
Are you looking for resources on PL1?
User avatar
mstam
New Member
Posts: 2
Joined: Mon Jan 18, 2021 3:36 pm

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

Post by mstam »

DB2 Guy wrote: Tue Jan 19, 2021 7:48 pm Are you looking for resources on PL1?
well, more for good references on relevant PL1 based training material.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

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