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
 

 

My OUTPUT file should be in this way

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: My OUTPUT file should be in this way
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    Post subject:
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 Moderator


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

PostPosted: Tue Jul 24, 2007 11:09 pm    Post subject:
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:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/

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    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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Incorrect output when trying to add n... monica1 PL/I & Assembler 10 Fri Jan 13, 2017 5:02 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


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