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

My OUTPUT file should be in this way


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

New User


Joined: 28 Jun 2007
Posts: 23
Location: Bangalore

PostPosted: Tue Jul 24, 2007 8:06 am
Reply with quote

Hi All,

I have a below requirement , Need your help on the below.

My input file has records like this.

Code:

   ABC-2
MAIN 1
   ABC-1
MAIN 2
   ABC-3
   ABC-6
MAIN 3


My OUTPUT file should be in this way

Code:

          ABC-2 MAIN 1
          ABC-1 MAIN 2
          ABC-3 000000
          ABC-6 MAIN 3


Here.. the OUTPUT file was formatted in such way that ..MAIN is being clubbed with ABC .. if MAIN
is found immediately after the ABC . IF MAIN was not there immediately after any ABC .. that particular ABC should be clubbed with zeroes or can be left blanks

Thq
[/quote]
Back to top
View user's profile Send private message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Tue Jul 24, 2007 2:48 pm
Reply with quote

Hi anish.ibm,
You haven't give LRECL of file, length of key, but still I have tried to provide you the soln with ceratin assumptions.
Here is your SORT JCL
Code:

//S1      EXEC PGM=ICETOOL                       
//TOOLMSG DD SYSOUT=*                           
//DFSMSG  DD SYSOUT=*                           
//*                                             
//IN1     DD *                                   
ABC-2                                           
MAIN1                                           
ABC-1                                           
MAIN2                                           
ABC-3                                           
ABC-6                                           
MAIN3                                           
/*                                               
//*                                             
//OUT1    DD SYSOUT=*                                                   
//TEMP    DD DSN=&&TEMP,SPACE=(CYL,(1,1),RLSE),DISP=(MOD,KEEP,DELETE)   
//TEMP1   DD DSN=&&TEMP1,SPACE=(CYL,(1,1),RLSE),DISP=(MOD,KEEP,DELETE) 
//TOOLIN  DD *                                                         
    COPY FROM(IN1) TO(TEMP) USING(SRT1)                                 
    SPLICE FROM(TEMP) TO(TEMP1) ON(1,10,ZD) -                           
      WITH(16,5) KEEPNODUPS                                             
    COPY FROM(TEMP1) TO(OUT1) USING(SRT2)                               
/*                                                                     
//SRT1CNTL DD *                                                     
    OPTION COPY                                                     
    OUTREC IFTHEN=(WHEN=INIT,                                       
           BUILD=(SEQNUM,10,ZD,11:1,5)),                           
           IFTHEN=(WHEN=(11,4,CH,EQ,C'MAIN'),                       
           BUILD=((1,10,ZD,SUB,+1),EDIT=(TTTTTTTTTT),5X,11,5))     
/*                                                                 
//*                                                                 
//SRT2CNTL DD *                                                     
    OPTION COPY                                                     
    OUTREC IFTHEN=(WHEN=(16,4,CH,EQ,C'MAIN'),                       
                   BUILD=(11,10)),                                 
           IFTHEN=(WHEN=NONE,                                       
                   BUILD=(11,5,C'00000'))                           
/*                                                                 


Output

Code:

ABC-2MAIN1   
ABC-1MAIN2   
ABC-300000   
ABC-6MAIN3   


--Parag
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Jul 24, 2007 11:09 pm
Reply with quote

anish,

Here's a more efficient way to do what you asked for. It only takes one SORT pass (for SPLICE) as opposed to Parag's way which takes one SORT pass (for SPLICE) and two COPY passes. You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use INREC with SPLICE. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

Use [URL] BBCode for External Links

Alternatively, without the April, 2006 PTF, you could do it in a COPY pass and one SORT pass (for SPLICE).

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN  DD *
   ABC-2
MAIN 1
   ABC-1
MAIN 2
   ABC-3
   ABC-6
MAIN 3
/*
//OUT DD SYSOUT=*
//TOOLIN   DD    *
SPLICE FROM(IN) TO(OUT) ON(81,8,ZD) KEEPNODUPS -
  WITH(17,6) USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,
          OVERLAY=(81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,1,CH,EQ,C' '),
          BUILD=(11:4,5,17:C'000000',81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=NONE,
          OVERLAY=(17:1,6,
            89:SEQNUM,8,ZD,
            81:81,8,ZD,SUB,89,8,ZD,M11,LENGTH=8))
  OUTFIL FNAMES=OUT,BUILD=(1,80)
/*
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top