Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Changing from the second record of the file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Roshnii

New User


Joined: 30 Sep 2008
Posts: 45
Location: bangalore

PostPosted: Tue Oct 21, 2008 12:42 pm    Post subject: Changing from the second record of the file
Reply with quote

Hi,

I have a file with records that i have to sort. But I want to start sorting from the second record. What option should I use?
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Tue Oct 21, 2008 12:47 pm    Post subject:
Reply with quote

Hello Roshanii,

Is first record conatin any string like header or some string which differntiate it with other records. & Secondly on what key u want to sort the records key length & offset etc

Would you please provide sample i/p & out put for that?
Back to top
View user's profile Send private message
Roshnii

New User


Joined: 30 Sep 2008
Posts: 45
Location: bangalore

PostPosted: Tue Oct 21, 2008 1:48 pm    Post subject:
Reply with quote

My input looks like this.

"0" header
1 roshni 100
1 sameer 200
1 pranati 300
1 keerthi 400
1 deepti 500

I have to sort from the second record and want the first record as it is in the output.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Tue Oct 21, 2008 2:05 pm    Post subject:
Reply with quote

Hello Roshni i,


Would you provide the sample input as well ?
Back to top
View user's profile Send private message
Roshnii

New User


Joined: 30 Sep 2008
Posts: 45
Location: bangalore

PostPosted: Tue Oct 21, 2008 2:28 pm    Post subject:
Reply with quote

My input looks like this
Code:


Header   record
sandrew bangalore  testing
akash              development
lisa    pune       testing
john               testing
        joan       harry
                   harry
bill



And My jcl goes like this


Code:


//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *

header record
sandrew bangalore  testing
akash              development
lisa    pune       testing
john               testing
        joan       harry
                   harry
bill

        frank      george
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(41:1,30)),
    IFTHEN=(WHEN=(41,7,CH,NE,C' '),
     OVERLAY=(1:C'"',41,7,C'",'),HIT=NEXT),
    IFTHEN=(WHEN=(41,7,CH,EQ,C' '),
     OVERLAY=(1:C',',9X),HIT=NEXT),
    IFTHEN=(WHEN=(49,10,CH,NE,C' '),
     OVERLAY=(11:C'"',49,10,C'",'),HIT=NEXT),
    IFTHEN=(WHEN=(49,10,CH,EQ,C' '),
     OVERLAY=(11:C',',12X),HIT=NEXT),
    IFTHEN=(WHEN=(60,11,CH,NE,C' '),
     OVERLAY=(24:C'"',60,11,C'",'),HIT=NEXT),
    IFTHEN=(WHEN=(60,11,CH,EQ,C' '),
     OVERLAY=(24:C',',13X))
  OUTREC BUILD=(1,37,SQZ=(SHIFT=LEFT))
/*




So my output looks like this

Code:


"header","record",
"sandrew","bangalore","testing",   
"akash",,"development",             
"lisa","pune","testing",           
"john",,"testing",                 
,"joan","harry",                   
,,"harry",                         
"bill",,,                           
,,,                                 
,"frank","george",




But I want the first record to be skipped and to appear in the output as it is. How do I skip the first record and apply the sort only from the second record?

So ideally my output should look like this


Code:


header record
"sandrew","bangalore","testing",   
"akash",,"development",             
"lisa","pune","testing",           
"john",,"testing",                 
,"joan","harry",                   
,,"harry",                         
"bill",,,                           
,,,                                 
,"frank","george",
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 995
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Tue Oct 21, 2008 3:01 pm    Post subject:
Reply with quote

Google Smart DFSORT Tricks.

Garry.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Oct 21, 2008 9:00 pm    Post subject:
Reply with quote

Roshnii,

Your description of what you want to do is quite confusing. You say you want to sort starting with the second record, but you're using OPTION COPY so you're NOT sorting, you're copying. What you really want to do is avoid changing the first record.

You were asked if there's something in the header to identify it, but you never answered that question which is an important one. You show 'header' in the header record. Is that string really there? If not, show what the header record actually looks like and indicate if there's something in the header record to identify it, or if it can only be identified as the first record.

What is the RECFM and LRECL of your input file?

What do you want for the RECFM and LRECL of your output file?
Back to top
View user's profile Send private message
Roshnii

New User


Joined: 30 Sep 2008
Posts: 45
Location: bangalore

PostPosted: Wed Oct 22, 2008 3:43 pm    Post subject: Reply to: Sorting from the second record of the file
Reply with quote

My header looks like this
Code:


"0","RECORD","STATION","LEVEL",



The "0" is always present in the header. Also it is always the first record of the file. My lrec is 558. And it will remain the same.

So my input file looks like this (before sort)

Code:


"0","RECORD","STATION","LEVEL",
1 REC001 10203040506 MEMBER     
1 REC002 10203040506 SUB HEADER



and after the sort my output should look like this

Code:

"0","RECORD","STATION","LEVEL",
"1","REC001","10203040506"," MEMBER",     
"1","REC002","10203040506","SUB HEADER",



and the header should appear as it is in the output.
But in my case the header is also getting sorted which I do not want.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Oct 22, 2008 8:53 pm    Post subject:
Reply with quote

Again, you're NOT sorting anything. You're copying!

All you have to do is use another IFTHEN clause to ensure that no changes are made to the record with "0". For example:

Code:

  INREC IFTHEN=(WHEN=INIT,OVERLAY=(41:1,30)),         
    IFTHEN=(WHEN=(1,3,CH,EQ,C'"0"'),OVERLAY=(1:1,1)),
    IFTHEN=(WHEN=(41,7,CH,NE,C' '),                   
     OVERLAY=(1:C'"',41,7,C'",'),HIT=NEXT),           
    ...


The second IFTHEN clause here identifies the "0" record and essentially does a NOP (overlays positions 1 with itself). Since we don't have HIT=NEXT for this clause, none of the other clauses will be executed for the "0" record.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 1 Tue Jul 25, 2017 12:12 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us