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
 

 

Have two processing in a single sort card.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Fri Jul 31, 2009 1:11 am    Post subject: Have two processing in a single sort card.
Reply with quote

Hi,

I have two requirements which I need to achieve using sort.

First:
There is a file FileA (FB, Lrecl=290). In this file we get some unreadable/junk values which I need to convert to spaces. this I have done using ALTSEQ command in sort. The sort card for which is as follows

Code:

SORT FIELDS=COPY                                             
  OUTREC OVERLAY=(6:6,206,TRAN=ALTSEQ,214:214,77,TRAN=ALTSEQ)
  ALTSEQ CODE=(0040,1040,2040,3040,0140,1140,2140,3140,     
               0240,1240,2240,3240,0340,1340,2340,3340,     
               0440,1440,2440,3440,0540,1540,2540,3540,     
               0640,1640,2640,3640,0740,1740,2740,3740,     
               0840,1840,2840,3840,0940,1940,2940,3940,     
               0A40,1A40,2A40,3A40,0B40,1B40,2B40,3B40,     
               0C40,1C40,2C40,3C40,0D40,1D40,2D40,3D40,     
               0E40,1E40,2E40,3E40,0F40,1F40,2F40,3F40,     
               4140,FF40)                                   


Second:
I need to compare FileA and FileB on a Field1 (position 1, length 5, Packed decimal) and if match is found then move 'Y' to Field2 of FileA (position 6, length 1, char) or else move 'N'. I am trying to figure out the sort for this. But is it possible to combine the above two sorts in one go. If so then please let me know.

Following will make it more clear.

FileA

Code:

       FIELD1      FIELD2
       5/PS        1/AN 
       (1-5)       (6-6)
       1---------- 2-----
****** ******************
000001           2 A     
000002          11 X     
000003          31 B     
000004          46 F     
000005          61 R     
000006          90 T     
000007         107 G



FileB
Code:

       FIELD1     
       5/PS       
       (1-5)     
       1----------
****** ***********
000001           2
000002          11
000003          30
000004          45
000005          61
000006          91
000007         108



Output File

Code:

       FIELD1      FIELD2
       5/PS        1/AN 
       (1-5)       (6-6)
       1---------- 2-----
****** ******************
000001           2 Y     
000002          11 Y     
000003          31 N     
000004          46 N     
000005          61 Y     
000006          90 N     
000007         107 N


Thanks,
Muffazel
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jul 31, 2009 1:26 am    Post subject:
Reply with quote

muffirulz,

What is the LRECL of FILEB?
Back to top
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Fri Jul 31, 2009 1:32 am    Post subject: Reply to: Have two processing in a single sort card.
Reply with quote

Hi,

The Lrecl of FileB is 5

Thanks,
Muffazel
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: Fri Jul 31, 2009 1:44 am    Post subject:
Reply with quote

Muffirulz,

You can use a DFSORT/ICETOOL job like the following to do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/290)
//IN2 DD DSN=...  input file2 (FB/5)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/290)
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,5,PD) KEEPNODUPS -
  WITH(1,5) WITH(7,285) USING(CTL3)
/*
//CTL1CNTL DD *
  INREC BUILD=(1,5,6:C'Y',291:C'BB')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(6:C'N',7,205,TRAN=ALTSEQ,214:214,77,TRAN=ALTSEQ,
    291:C'VV')
  ALTSEQ CODE=(0040,1040,2040,3040,0140,1140,2140,3140,
               0240,1240,2240,3240,0340,1340,2340,3340,
               0440,1440,2440,3440,0540,1540,2540,3540,
               0640,1640,2640,3640,0740,1740,2740,3740,
               0840,1840,2840,3840,0940,1940,2940,3940,
               0A40,1A40,2A40,3A40,0B40,1B40,2B40,3B40,
               0C40,1C40,2C40,3C40,0D40,1D40,2D40,3D40,
               0E40,1E40,2E40,3E40,0F40,1F40,2F40,3F40,
               4140,FF40)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,OMIT=(291,2,CH,EQ,C'BB'),BUILD=(1,290)
/*
Back to top
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Fri Jul 31, 2009 2:21 am    Post subject: Reply to: Have two processing in a single sort card.
Reply with quote

Frank,

Thanks a lot. The solution works fine.
I tried using sort in place of icetool (since my existing production job contains sort). There seemed to be a problem.

While using sort will all the existinf syntax remamin same or there will be a change.

Thanks,
Muffazel
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: Fri Jul 31, 2009 2:36 am    Post subject:
Reply with quote

PGM=SORT is NOT the same as PGM=ICETOOL! You can't use them interchangeably. You must use PGM=ICETOOL for this job.

PGM=SORT invokes DFSORT. PGM=ICETOOL invokes DFSORT's ICETOOL. DFSORT and ICETOOL require different JCL and syntax.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss?rs=0&uid=isg3T7000080
Back to top
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Fri Jul 31, 2009 3:50 am    Post subject: Reply to: Have two processing in a single sort card.
Reply with quote

Frank,

I had changed the basic syntax between SORT and ICETOOL. The job was also modified and I am trying to change the solution so that I can use it with sort rather than with ICETOOL. My main reason to combine both is because currently we are using SORT in production and using ICETOOL will require changes in JCL and Proc as well. So to avois this I am trying to combine the new requirement with old sort in production.

Therefore I am looking for some solution in SORT .

Thanks,
Muffazel
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jul 31, 2009 4:19 am    Post subject: Reply to: Have two processing in a single sort card.
Reply with quote

muffirulz,

Use the following DFSORT JCL

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=your input 290 byte file,DISP=SHR
//SORTOUT  DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)     
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  INREC OVERLAY=(291:X)                                         
//*                                                             
//STEP0200 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD DSN=your input 5 bytes file,DISP=SHR
//SORTOUT  DD DSN=&&T2,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)     
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  INREC OVERLAY=(291:C'$')                                     
//*                                               
//STEP0300 EXEC PGM=SORT         
//SYSOUT   DD SYSOUT=*           
//SORTIN   DD DSN=&&T2,DISP=SHR   
//         DD DSN=&&T1,DISP=SHR   
//SORTOUT  DD SYSOUT=*           
//SYSIN    DD *     
//SYSIN    DD *                                               
  SORT FIELDS=(1,5,PD,A),EQUALS
                               
  OUTREC IFTHEN=(WHEN=INIT,                                   
  OVERLAY=(6:C'N',293:SEQNUM,8,ZD,RESTART=(1,5))),             
  IFTHEN=(WHEN=GROUP,BEGIN=(293,8,ZD,EQ,1),PUSH=(292:291,1)), 
  IFTHEN=(WHEN=(292,1,CH,EQ,C'$'),OVERLAY=(6:C'Y'))           

  OUTFIL OMIT=(291,2,CH,EQ,C'$$'),                             
  BUILD=(1,6,7:7,205,TRAN=ALTSEQ,214:214,77,TRAN=ALTSEQ)       
  ALTSEQ CODE=(0040,1040,2040,3040,0140,1140,2140,3140,       
               0240,1240,2240,3240,0340,1340,2340,3340,       
               0440,1440,2440,3440,0540,1540,2540,3540,       
               0640,1640,2640,3640,0740,1740,2740,3740,       
               0840,1840,2840,3840,0940,1940,2940,3940,       
               0A40,1A40,2A40,3A40,0B40,1B40,2B40,3B40,       
               0C40,1C40,2C40,3C40,0D40,1D40,2D40,3D40,       
               0E40,1E40,2E40,3E40,0F40,1F40,2F40,3F40,       
               4140,FF40)
//*
Back to top
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Mon Aug 03, 2009 7:01 pm    Post subject: Reply to: Have two processing in a single sort card.
Reply with quote

Thanks Skolusu...

Regards,
Muffazel
Back to top
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Mon Aug 03, 2009 7:11 pm    Post subject: Reply to: Have two processing in a single sort card.
Reply with quote

Skolusu,

If I can make both files of same length 290 bytes can we combine the above three steps into one single step. Can be sort/icetool...

Sorry for overhead. A small change in the requirement happened.
Appreciate ur help...

Thanks,
Muffazel
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Aug 03, 2009 10:03 pm    Post subject:
Reply with quote

muffirulz,

If you create the 2 files with equals lengths you can get the desired results with just 1 sort step. However create the look up file with a string that is unique to the look up file. Here I used '$' symbol. So if you create the look up file with something like that then we can get the desired results in one step.
Back to top
View user's profile Send private message
muffirulz

New User


Joined: 14 Sep 2005
Posts: 74
Location: Kentucky, USA

PostPosted: Tue Aug 04, 2009 12:22 am    Post subject: Reply to: Have two processing in a single sort card.
Reply with quote

Skolusu,

I have coded the following for the above problem. hope its right.

Code:


//STEP01   EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD *                                                     
HDR                                                                 
//         DD DSN=TESTMEN.ODS.PERSON.SNAPSHOT.DT0803A,               
//            DISP=SHR                                               
//         DD *                                                     
HDR                                                                 
//         DD DSN=TESTMEN.ODS.PERSON.SNAPSHOT.DT0803B,               
//            DISP=SHR                                               
//SORTOUT  DD DSN=TESTMEN.ODS.PERSON.SNAPSHOT.DT0803C,               
//            DISP=(NEW,CATLG,DELETE),                               
//            UNIT=SYSDA                                             
//SYSIN    DD *                                                     
                                                                     
  OPTION EQUALS                                                     
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),PUSH=(291:ID=1)),
  IFTHEN=(WHEN=(291,1,ZD,EQ,1),OVERLAY=(292:X)),                     
  IFTHEN=(WHEN=(291,1,ZD,EQ,2),OVERLAY=(292:C'$'))                   
  SORT FIELDS=(1,5,PD,A)                                             
                                                                     
  OUTREC IFTHEN=(WHEN=INIT,                                         
  OVERLAY=(6:C'N',293:SEQNUM,8,ZD,RESTART=(1,5))),                   
  IFTHEN=(WHEN=GROUP,BEGIN=(293,8,ZD,EQ,1),PUSH=(292:291,1)),       
  IFTHEN=(WHEN=(292,1,CH,EQ,C'$'),OVERLAY=(6:C'Y'))                 
                                                                     
  OUTFIL OMIT=(291,2,CH,EQ,C'$$'),                                   
  BUILD=(1,6,7:7,205,TRAN=ALTSEQ,214:214,77,TRAN=ALTSEQ)             
  ALTSEQ CODE=(0040,1040,2040,3040,0140,1140,2140,3140,             
               0240,1240,2240,3240,0340,1340,2340,3340,             
               0440,1440,2440,3440,0540,1540,2540,3540,             
               0640,1640,2640,3640,0740,1740,2740,3740,             
               0840,1840,2840,3840,0940,1940,2940,3940,             
               0A40,1A40,2A40,3A40,0B40,1B40,2B40,3B40,             
               0C40,1C40,2C40,3C40,0D40,1D40,2D40,3D40,             
               0E40,1E40,2E40,3E40,0F40,1F40,2F40,3F40,             
               4140,FF40)                                           
/*                                                                   


When trying to execute the above I am getting the following error.

Code:

ICE143I 0 BLOCKSET     SORT  TECHNIQUE SELECTED                                 
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 14:50 ON MON AUG
                                                                               
            OPTION EQUALS                                                       
            INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),PUSH=(291:ID=1)),
            IFTHEN=(WHEN=(291,1,ZD,EQ,1),OVERLAY=(292:X)),                     
            IFTHEN=(WHEN=(291,1,ZD,EQ,2),OVERLAY=(292:C'$'))                   
            SORT FIELDS=(1,5,PD,A)                                             
                                                                               
            OUTREC IFTHEN=(WHEN=INIT,                                           
            OVERLAY=(6:C'N',294:SEQNUM,8,ZD,RESTART=(1,5))),                   
            IFTHEN=(WHEN=GROUP,BEGIN=(294,8,ZD,EQ,1),PUSH=(293:292,1)),         
            IFTHEN=(WHEN=(293,1,CH,EQ,C'$'),OVERLAY=(6:C'Y'))                   
                                                                               
            OUTFIL OMIT=(292,2,CH,EQ,C'$$'),                                   
            BUILD=(1,6,7:7,205,TRAN=ALTSEQ,214:214,77,TRAN=ALTSEQ)             
            ALTSEQ CODE=(0040,1040,2040,3040,0140,1140,2140,3140,               
                         0240,1240,2240,3240,0340,1340,2340,3340,               
                         0440,1440,2440,3440,0540,1540,2540,3540,               
                         0640,1640,2640,3640,0740,1740,2740,3740,               
                         0840,1840,2840,3840,0940,1940,2940,3940,               
                         0A40,1A40,2A40,3A40,0B40,1B40,2B40,3B40,               
                         0C40,1C40,2C40,3C40,0D40,1D40,2D40,3D40,               
                         0E40,1E40,2E40,3E40,0F40,1F40,2F40,3F40,               
                         4140,FF40)                                             
ICE063A 2 OPEN ERROR SORTIN                                                     
ICE751I 0 C5-K90013 C6-K90013 C7-K90000 C8-K42135 E7-K44563                     
ICE052I 3 END OF DFSORT                                                                     


Both the files are present and are of length 290.
Let me know if I am missing out something.

Thanks,
Muffazel
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 Aug 04, 2009 1:01 am    Post subject:
Reply with quote

Quote:
Let me know if I am missing out something.


Code:

//SORTIN   DD *                                                     
HDR   


DD * data sets have LRECL=80 which conflicts with the LRECL=290 of your input data sets.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Aug 04, 2009 1:12 am    Post subject: Reply to: Have two processing in a single sort card.
Reply with quote

muffirulz,

You are concatenating a 80 byte in stream data with a 290 byte dataset which is NOT valid and hence the error. You need to create the header record separately for 290 bytes.

Use the following JCL. step0100 will create a hdr record with 290 bytes and we will concatenate that in the next step.
Code:

//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD DUMMY,DCB=(LRECL=290,RECFM=FB,BLKSIZE=27840)   
//SORTOUT  DD DSN=&&H,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)   
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
  OUTFIL REMOVECC,TRAILER1=(C'HDR',290:X)                   
/*     
//STEP0200 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=&&H,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT               
//         DD DSN=&&Your input with just account numbers,DISP=SHR
//         DD DSN=&&H,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT               
//         DD DSN=&&your data file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  OPTION EQUALS                                                         
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),PUSH=(291:ID=1))   
  SORT FIELDS=(1,5,PD,A)                                               
  OUTREC IFTHEN=(WHEN=INIT,                                             
  OVERLAY=(6:C'N',293:SEQNUM,8,ZD,RESTART=(1,5))),                     
  IFTHEN=(WHEN=GROUP,BEGIN=(293,8,ZD,EQ,1),PUSH=(292:291,1)),           
  IFTHEN=(WHEN=(291,2,ZD,EQ,21),OVERLAY=(6:C'Y'))                       
  OUTFIL INCLUDE=(291,2,ZD,GE,21,AND,1,3,CH,NE,C'HDR'),                 
  BUILD=(1,5,6:6,206,TRAN=ALTSEQ,214:214,77,TRAN=ALTSEQ)               
  ALTSEQ CODE=(0040,1040,2040,3040,0140,1140,2140,3140,                 
               0240,1240,2240,3240,0340,1340,2340,3340,                 
               0440,1440,2440,3440,0540,1540,2540,3540,                 
               0640,1640,2640,3640,0740,1740,2740,3740,                 
               0840,1840,2840,3840,0940,1940,2940,3940,                 
               0A40,1A40,2A40,3A40,0B40,1B40,2B40,3B40,                 
               0C40,1C40,2C40,3C40,0D40,1D40,2D40,3D40,                 
               0E40,1E40,2E40,3E40,0F40,1F40,2F40,3F40,                 
               4140,FF40)   
//*
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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 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 Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


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