|
|
| Author |
Message |
dhivakarram
New User
Joined: 27 Jul 2006 Posts: 4 Location: chennai
|
|
|
|
how to retrive, how many of the employees working in a company starting with the name A (eg:-arun,aakash likewise) from a emolyee file using mvs cobol. without using any sql or jcl its should be done with pure cobol.
:( anybody plz help me :( |
|
| Back to top |
|
 |
References
|
Posted: Fri Aug 04, 2006 3:39 pm Post subject: Re: Employees working in a company starting with the name 'A' |
 |
|
|
 |
muthuvel
Active User
Joined: 29 Nov 2005 Posts: 179 Location: Chennai
|
|
|
|
hi,
Suppose if the ws-name is PIC X(9) redefine it as ws-initial as PIC X(1) and ws-remainder PIC X(8) .So in the cobol program compare
ws-initial='A' .
Hence the names with starting letter 'A' could be retreived.
Issues if any please let me know,
Thanks,
Muthuvel. |
|
| Back to top |
|
 |
priyesh.agrawal
Global Moderator
Joined: 28 Mar 2005 Posts: 1511 Location: Chicago, IL
|
|
|
|
Another Way...
| Code: |
READ INPUT FILE INTO WS-EMP-REC.
PERFORM PROCESS UNTIL END-OF-FILE.
PROCESS.
IF WS-EMP-NAME(1:1) = 'A'
WRITE OUTPUT.
ADD 1 TO OUT-A-COUNTER.
ELSE
ADD 1 TO NON-A-COUNTER.
END-IF.
EXIT.
DISPLAY 'TOTAL EMPLOYEES WITH NAME STARTING FROM A' OUT-A-COUNTER. |
|
|
| Back to top |
|
 |
|
|