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

Regarding Sorting from a file


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

New User


Joined: 16 Jun 2005
Posts: 63

PostPosted: Thu Apr 03, 2008 2:28 pm
Reply with quote

Hi all,

I'm required to do copy some records from a file to another file using SORT utility.

I have one source PS flat file where it contains only one record as below

Source File:
1234520080403

I have one another Destination PS flat file where it contains lot many records as below. I wanted to place the above record from source file to the expected position in destination file without disturbing Greeting message in first line as explained below.

Destination File:
Greeting!! Welcome to IBM Mainframe Forum.

Sr Number: 12345 <First five digit of source PS file>
JoinDate: 04/03/2008 <Date from source PS file>
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 174
Location: Bangalore

PostPosted: Thu Apr 03, 2008 5:42 pm
Reply with quote

Here is the SORT as you required

Code:
//S2       EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//IN1      DD *
1234520080403
/*
//TOOLIN  DD *
   COPY FROM(IN1) TO(OUT) USING(CTL1)
//OUT     DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(TRK,(1,1)),UNIT=SYSDA
//CTL1CNTL DD    *
  OUTFIL REMOVECC,
  HEADER1=('GREETING!! WELCOME TO IBM MAINFRAME FORUM.',53:14,1,/,
           'SR NUMBER:',12:1,5),
  HEADER2=('JOINDATE:',11:12,2,'/',14:10,2,'/',17:6,4)
/*
//S2       EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//SYSOUT   DD  SYSOUT=*
//IN      DD DSN=&&T1,DISP=OLD
//TOOLIN  DD *
   COPY FROM(IN) TO(OUT) USING(CTL2)
//OUT     DD SYSOUT=*
//CTL2CNTL DD    *
  OMIT COND=(1,5,CH,EQ,C'12345')
/*


After this you can concatenate your Detination file to this
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: Thu Apr 03, 2008 9:49 pm
Reply with quote

Mr. Niceguy,

Here's a DFSORT job that will do what I think you asked for. I showed the input files as inline (DD *), but you can use DSN=... for them if appropriate.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *   source file
1234520080403
/*
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL BUILD=(C'TNUM,''',1,5,C'''',80:X,/,
                C'TDATE,''',10,2,C'/',12,2,C'/',6,4,C'''')
/*
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD *    destination file
Greeting!! Welcome to IBM Mainframe Forum.

Sr Number:
JoinDate:
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,10,CH,EQ,C'Sr Number:'),
    OVERLAY=(12:TNUM)),
   IFTHEN=(WHEN=(1,9,CH,EQ,C'JoinDate:'),
    OVERLAY=(11:TDATE))
/*
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
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