IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

JCL SORT to compress the student's details


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rajesh7523

New User


Joined: 15 Dec 2022
Posts: 8
Location: BHOPAL

PostPosted: Thu Dec 15, 2022 8:49 pm
Reply with quote

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
View user's profile Send private message
rajesh7523

New User


Joined: 15 Dec 2022
Posts: 8
Location: BHOPAL

PostPosted: Thu Dec 15, 2022 9:06 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Thu Dec 15, 2022 9:28 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Thu Dec 15, 2022 9:31 pm
Reply with quote

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
View user's profile Send private message
rajesh7523

New User


Joined: 15 Dec 2022
Posts: 8
Location: BHOPAL

PostPosted: Fri Dec 16, 2022 12:41 pm
Reply with quote

pls help me with logic
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Fri Dec 16, 2022 1:53 pm
Reply with quote

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. icon_exclaim.gif
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Fri Dec 16, 2022 5:34 pm
Reply with quote

rajesh7523 wrote:
pls help me with logic


The LOGIC is not the same as the READY TO USE CODE!!!
824.gif sterb050.gif 12.gif
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Sat Dec 17, 2022 12:47 am
Reply with quote

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?" icon_pray.gif
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" ... icon_axe.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top