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
 

 

Regarding Sorting from a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Regarding Sorting from a file
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: 171
Location: Bangalore

PostPosted: Thu Apr 03, 2008 5:42 pm    Post subject: Reply to: Regarding Sorting from a file
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 Moderator


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

PostPosted: Thu Apr 03, 2008 9:49 pm    Post subject:
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    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 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
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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