| IBM MAINFRAME HELP & SUPPORT FORUMS Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
|
| View previous topic :: View next topic |
| Author |
Message |
purushoth_jp
Joined: 12 Dec 2004
Posts: 22
|
| Posted: Mon Feb 14, 2005 6:39 am Post subject: interview questions |
|
|
hi all,
1. Iam having 2 files. first file contains 100,000 records, second file contains some 100 records. there are 10 records which are in both the files. can anyone plz suggest a method to separate the common records (i.e 10 records) in both the files and to place it in new file. using JCL or some other functions.
2. there is a table which is defined as
01 table1.
05 a pic X(1) occurs 5 times.
now in the procedure division im accepting values for the elements in the table. the content of the table is
a(1) = e, a(2) = d, a(3) = c, a(4) = b, a(5) = a.
is there is any function to sort the table in ascending order. so that the result will be
a(1) = a, a(2) = b, a(3) = c, a(4) = d, a(5) = e
or to reverse the table.
3.Is there is any function to find a length of a variable. |
|
| Back to top |
|
rick
Joined: 18 Jun 2004
Posts: 61
Location: Kuzhithurai
|
| Posted: Thu Feb 17, 2005 2:51 pm Post subject: |
|
|
Hi,
1. I dont think there is any function to do this.
2. It can be sorted using SORT command in cobol. If u want the reverse you can give decending order in the SORT command.
3. Yea we can find the length of the variable using the following
COMPUTE VAR1 = LENGTH OF VAR2.
Regards,
Rick.
frederick.tybalt@anewcon.com |
|
| Back to top |
|
mdtendulkar
Joined: 29 Jul 2003
Posts: 257
Location: USA
|
| Posted: Fri Feb 18, 2005 7:07 am Post subject: |
|
|
purushoth,
1) you can write a small easytrieve program to get this thing done. Currently I am totally swamped with the work so will not be able to post the code..
If you can wait till weekend, I can give you the solution
Regards
Mayuresh |
|
| Back to top |
|
shantibhusan
Joined: 19 Apr 2005
Posts: 2
|
| Posted: Tue Apr 19, 2005 8:34 pm Post subject: Re: interview questions |
|
|
1.Use the below jcl for getting the common records on FILE3.
000001 //JOBNAME JOB (,,,,#####),
000003 // CLASS=V,
000004 // NOTIFY=&SYSUID,
000005 // MSGCLASS=Q
000006 //* TO SORT AND SHIFT FIELDS
000007 //SORTIT EXEC PGM=SYNCSORT,PARM='ABEND'
000008 //SYSOUT DD SYSOUT=*
000009 //SORTIN DD DSN=FILE1
000010 // DD DSN=FILE2
000011 //SORTOUT DD SYSOUT=*
000012 //SORTXSUM DD DSN=FILE3
000013 //SYSIN DD *
000014 SORT FIELDS=(1,RECORD LENGTH OF FILE,CH,A)
000015 SUM FIELDS=NONE,XSUM
000016 /* |
|
| Back to top |
|
shantibhusan
Joined: 19 Apr 2005
Posts: 2
|
| Posted: Tue Apr 19, 2005 8:39 pm Post subject: Re: interview questions |
|
|
2.It is not possible to sort a table using SORT function in COBOL. SORT function is only used for files.To sort table use ur own logic in the procedure division like bubble sort.
Any body knows any other function to sort a table ????? |
|
| Back to top |
|
ashutosh719
Joined: 06 Apr 2005
Posts: 13
|
| Posted: Sat May 07, 2005 2:12 pm Post subject: |
|
|
for #3 uses STRLEN function in COBOL.
for #1 use SPLICE. |
|
| Back to top |
|
mmwife
Joined: 30 May 2003
Posts: 1508
|
| Posted: Sun May 15, 2005 5:44 am Post subject: |
|
|
A little late to the party. :D
But, if the table is designated as being in descending order, you can use the reverse intrinsic function to put it in ascending order. You might try this:
MOVE FUNCTION REVERSE(TABLE1) TO TABLE1.
If the compiler doesn't let you do it, move it to a temp fld reversed, then move it back to TABLE1. |
|
| Back to top |
|
ajay_dheepak
Joined: 12 May 2005
Posts: 33
Location: Chennai
|
| Posted: Wed May 18, 2005 11:44 am Post subject: |
|
|
Ashutosh,
Can u please give short examples for SPLICE and STRLEN?
Ajay |
|
| Back to top |
|
ikumar
Joined: 02 Aug 2005
Posts: 85
|
| Posted: Mon Aug 08, 2005 2:39 pm Post subject: Re: interview questions |
|
|
3. you can use Function LENGTH(string-name) or special register LENGTH OF to determine the length of a particular string/variable (either numeric data or alphanumeric)
You can use the LENGTH Function only where arithmetic expressions are allowed. However, you can use the LENGTH OF special register in many other contexts, for example, as a parameter in CALL, as an argument to an intrinsic function that allows integer arguments.
Thanks,
Kumar |
|
| Back to top |
|
MGIndaco
Joined: 10 Mar 2005
Posts: 478
Location: Milan, Italy
|
| Posted: Sat Aug 13, 2005 12:51 am Post subject: |
|
|
1) Try to search in DfSort entry and you will find the solution!
Your question is well satisfied in many sample. |
|
| Back to top |
|
| |
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM
|