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

Sort card Logic


IBM Mainframe Forums -> HomeWorks & Requests
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
rajeshmehra
Currently Banned

New User


Joined: 06 Dec 2022
Posts: 5
Location: India

PostPosted: Tue Dec 06, 2022 2:46 pm
Reply with quote

I have a record of 10 pages and every page has policies and details, policies may be the same or different.

i want to add 1 line at the top of policies and 1 at the end but I have to compare the policies, if policies are matching/are similar. if polcies are matching then I have to add 1 line at the top and 1 at the end of similar policies.

Can u tell me the sort card logic? how to write?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Tue Dec 06, 2022 5:47 pm
Reply with quote

Welcome!
You could have searched this forum or Google and provided input and expected output data .
ibmmainframes.com/about60729.html
I would let you search for trailer and twist the card.
Back to top
View user's profile Send private message
rajeshmehra
Currently Banned

New User


Joined: 06 Dec 2022
Posts: 5
Location: India

PostPosted: Tue Dec 06, 2022 6:03 pm
Reply with quote

thank you, Rohit for your reply,

My Expected Output -

Code:

CUSTNO,ITEM,COST
1001,234,23.00
1001,437,87.00
1001,787,89.00
Add tails
CUSTNO,ITEM,COST
1002,777,20.00
1002,343,23.30
Add tails
CUSTNO,ITEM,COST
1003,778,09.00
1003,989,99.00
1003,999,99.00
Add tails


I have added the Tails line at the end of every data.

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

Senior Member


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

PostPosted: Tue Dec 06, 2022 7:23 pm
Reply with quote

Adjust where necessary.

Code:
//WHATEVER EXEC PGM=ICEMAN           
//SORTIN   DD *                       
1001,234,23.00                       
1001,437,87.00                       
1001,787,89.00                       
1002,777,20.00                       
1002,343,23.30                       
1003,778,09.00                       
1003,989,99.00                       
1003,999,99.00                       
/*                                   
//SYSOUT   DD SYSOUT=*               
//SORTOUT  DD SYSOUT=*               
//SYSIN    DD *                       
  OPTION COPY                         
  OUTFIL FNAMES=(SORTOUT),           
    SECTIONS=(1,4,SKIP=1L,           
      HEADER3=(C'CUSTNO,ITEM,COST')) 
  END                                 
/*
Back to top
View user's profile Send private message
rajeshmehra
Currently Banned

New User


Joined: 06 Dec 2022
Posts: 5
Location: India

PostPosted: Tue Dec 06, 2022 7:49 pm
Reply with quote

could u pls explain this logic,

how it is comparing the first 4 digits no.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Tue Dec 06, 2022 7:54 pm
Reply with quote

Please read SECTIONS, that offset within SECTIONS 1,4 is key breaker
Detailed explanation-
www.ibm.com/docs/en/zos/2.1.0?topic=outfil-sections
Back to top
View user's profile Send private message
rajeshmehra
Currently Banned

New User


Joined: 06 Dec 2022
Posts: 5
Location: India

PostPosted: Wed Dec 07, 2022 8:41 am
Reply with quote

I am using this:

SORT FIELDS=COPY
OUTFIL FNAMES=SORTOUT,
SECTIONS=(10,19,SKIP=P,
HEADER1=(1:'START',/,
1:'KEY ',/,
1:'LOB ',/,
1:'START',/,
1:'KEY '),
TRAILER1=(1:'END',/,
1:'END'))

but getting a syntax error ABENDU0223
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Wed Dec 07, 2022 9:57 am
Reply with quote

When posting code/data, please use the code tag button. icon_exclaim.gif

HEADER1 and TRAILER1 do NOT belong inside a SECTION statement.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Wed Dec 07, 2022 5:52 pm
Reply with quote

Topic will be locked soon . You need to read the manual link posted above and has everything needed.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Wed Dec 07, 2022 9:26 pm
Reply with quote

rajeshmehra wrote:
I am using this:

Code:
SORT FIELDS=COPY               
   OUTFIL FNAMES=SORTOUT,     
   SECTIONS=(10,19,SKIP=P,     
   HEADER1=(1:'START',/,       
      1:'KEY ',/,             
      1:'LOB ',/,             
      1:'START',/,             
      1:'KEY '),               
   TRAILER1=(1:'END',/,       
      1:'END'))   


but getting a syntax error ABENDU0223


1) Please learn, how to use the Code button when posting

2) Please, read at least ANY SINGLE manual, before asking at the forum
Back to top
View user's profile Send private message
rajeshmehra
Currently Banned

New User


Joined: 06 Dec 2022
Posts: 5
Location: India

PostPosted: Mon Dec 12, 2022 2:28 pm
Reply with quote

Suppose the below one is an input file where students' details are misplaced/unordered.

We want to compress the student's details by the student.

Like: the students1 has all records ( name, mob no. ) then student2 will start, and so on... also we want to write a single line ( start record ) before the student's details & after the end of the record ( end record )

let me know how to write the jcl sort logic.

Input File:

00001 student1 dept1 560
Name
00003 student3 dept2 520
Name
00004 student4 dept1 540
Name
Mob. No.
00005 student1 dept1 500
Mob. no.
00002 student3 dept3 510
Mob. No.
00006 student2 dept3 550
Mob. no.
00008 student2 dept1 530
Name


Expected O/P:


Start Record
00001 student1 dept1 560
Name
Mob. no.
End Record

Start Record
00002 student2 dept3 550
Name
Mob. no.
End Record


Start Record
00003 student3 dept2 520
Name
Mob. no.
End Record


Start Record
00004 student4 dept1 540
Name
Mob. No.
End Record


[/code]
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Mon Dec 12, 2022 4:22 pm
Reply with quote

If you have a different request, please open a new thread. Also show what you have attempted so far to solve your requirement.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Mon Dec 12, 2022 6:33 pm
Reply with quote

Locked and please open a new thread with proper code tags.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> HomeWorks & Requests

 


Similar Topics
Topic Forum Replies
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts Is this possible via sort (in one pass)? SYNCSORT 4
No new posts GDG generation name to GDG Base name ... DFSORT/ICETOOL 3
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts FB to .CSV conversion using sort DFSORT/ICETOOL 7
Search our Forums:

Back to Top