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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 1 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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