|
View previous topic :: View next topic
|
| Author |
Message |
rajesh7523
New User
Joined: 15 Dec 2022 Posts: 8 Location: BHOPAL
|
|
|
|
PLEASE let me know the code
We want to compress the student's details by checking the 5-digit no ( 00001,00003 and 00004) if it is the same on the next pages then no need to write the (start record) again neither ( end record) . and if it is different then only we have to write ( End record ) after this it will check other pages and so on...
Like: the 00001 has all records ( name, mob no. ) then 00002 will came, and so on...
we want to write a single line ( start record ) before the 00001 details & after the end of all 00001 records ( end record )
every page have 1 student's records
Input File
| Code: |
000001
000002 1 00001 student1 dept1 560
000003 Name
000004 Mob. no.
000005
000006 1 00001 student2 dept1 550
000007 Mob. no2.
000008 Name2
000009
000010 1 00001 student3 dept2 550
000011 Mob. no3.
000012 Name3
000013
000014 1 00003 student4 dept2 520
000015 Name
000016 Mob. No.
000017
000018 1 00004 student4 dept3 540
000019 Name2
000020 Mob. No2. |
Output File :-
| Code: |
000001 Start Record
000002 1 00001 student1 dept1 560
000003 Name
000004 Mob. no.
000005
000006 student2 dept1 550
000007 Mob. no2.
000008 Name2
000009
000010 student3 dept2 550
000011 Mob. no3.
000012 Name3
000013 End Record
000014
000015 Start Record
000016 1 00003 student4 dept2 520
000017 Name
000018 Mob. No.
000019 End Record
000020
000021 Start Record
000022 1 00004 student4 dept3 540
000023 Name2
000024 Mob. No2.
000025 End Record |
|
|
| Back to top |
|
 |
rajesh7523
New User
Joined: 15 Dec 2022 Posts: 8 Location: BHOPAL
|
|
|
|
1 mistake in o/p file
we are writing 00001 too for students2 & students3 and not writing "1" in students2 & students3 ( which is coming in starting ) |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2272 Location: USA
|
|
|
|
If you really need JCL SORT, here it is
| Code: |
//SORTSTEP EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=your_input_dataset
//SORTOUT DD DISP=...,DSN=your_output_dataset
//SYSIN DD *
your_control_statements
//* |
In the your_sort_statements you need to use WHEN=GROUP, IFTHEN=, and other SORT CONTROL STATEMENTS.
Please, start reading SORT manuals, and analyzing the existing examples. |
|
| Back to top |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
| Quote: |
| PLEASE let me know the code |
This is a HELP forum, not a WRITE-THE-CODE-FOR-YOU forum. If you want code, be prepared to pay someone for it (the usual going rate is about 1000 US dollars -- or euros -- per day or part of a day for coding). |
|
| Back to top |
|
 |
rajesh7523
New User
Joined: 15 Dec 2022 Posts: 8 Location: BHOPAL
|
|
|
|
| pls help me with logic |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1431 Location: Bamberg, Germany
|
|
|
|
| Code: |
INREC IFTHEN=(WHEN=INIT,OVERLAY=(X,42:C'1')),
IFTHEN=(WHEN=GROUP,BEGIN=(4,1,FS,EQ,NUM),PUSH=(30:4,5,ID=5,SEQ=2))
SORT FIELDS=(30,12,ZD,A)
OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(30,5),PUSH(42,1),RECORDS=1)
OUTFIL FNAMES=(SORTOUT),
SECTIONS=(30,5,SKIP=1L,
HEADER3=(C'Start Record'),
TRAILER3=(C'End Record')),
BUILD=(1,29)
END |
You must update the logic to remove excessive blank lines at the end of each section. However, show something you have attempted yourself before asking again.  |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2272 Location: USA
|
|
|
|
| rajesh7523 wrote: |
| pls help me with logic |
The LOGIC is not the same as the READY TO USE CODE!!!
 |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2272 Location: USA
|
|
|
|
| rajesh7523 wrote: |
| pls help me with logic |
The ability to understand, and to develop the LOGIC (or the ALGORITHM) of the assigned task - is the major responsibility of any software developer. (Not familiarity with any programming language, or tool, as many mistakenly assume).
If one is not able to understand, at least in general, the algorithm of his assigned task, then - pardon my French - that person must think about changing his job...
It is exactly the same situation, as if you called in a plumber to fix your bathroom leakage, and the plumber started from asking you: "Please, help me with explanation: how do I need to fix it?"
Another example - you've called a taxi to go to the airport, and the taxi driver asked you: "Please, help me with driving the car, and also explain me the traffic rules" ...  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|