Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 IDCAMS RENAMING VSAM FILE ALONG WITH ... upendrasri JCL & VSAM 11 Tue Apr 17, 2018 10:42 pm
No new posts VSAM file NOT Found error while proce... SumaReva CICS 5 Wed Apr 11, 2018 9:54 pm
No new posts converting a mainframe file with ASA ... Lynne Schuler All Other Mainframe Topics 5 Wed Apr 04, 2018 9:44 am
No new posts VSAM File free space sancraig16 JCL & VSAM 13 Fri Mar 30, 2018 1:02 am
No new posts write multiple lines in PS file in cobol Balu5491 COBOL Programming 7 Wed Mar 07, 2018 10:27 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us