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
 

 

Sort card input from file

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

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Fri Jul 10, 2009 3:25 am    Post subject: Sort card input from file
Reply with quote

Hi,

I am getting an input in a notepad with 100's of account number which needs to be filtered and ftp'd to my user. I have written a JCL such that it will copy all the records with the particular date range and with the defined account numbers.

Code:

Sample:

SORT FIELDS=COPY                                               
INCLUDE COND=((8,5,PD,GE,20090529,AND,8,5,PD,LE,20090712),AND,
(41,9,CH,EQ,C'123456DH6',OR,                                   
41,9,CH,EQ,C'123456DJ2',OR,                                   
41,9,CH,EQ,C'123456DK9',OR,                                   
41,9,CH,EQ,C'123456DL7',OR,                                   
41,9,CH,EQ,C'123456DM5'))


Here my requirment is everytime i am manually pasting all the Account number into my sort card. Is there any way that we can copy all account# from a file into this sort car?

I can ftp the details from notepad to mainframe with all account number.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Jul 10, 2009 3:50 am    Post subject:
Reply with quote

sounds like what you want to do is have the account no from the notepad as one file, and 'your other file', and only output those from the 'other file' that match your notepad file, as well as filter all from 'the other file' within a given date range.
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 10, 2009 3:55 am    Post subject:
Reply with quote

You can use a DFSORT job like the following. I assumed that the account file has RECFM=FB and the account numbers are in positions 1-9.

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *   account number file (FB)
123456DH6
123456DJ2
123456DK1
/*
//SORTOUT DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(5:C'41,9,CH,EQ,C''',1,9,C''',OR,',80:X)
//S2    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  INCLUDE COND=((8,5,PD,GE,20090529,AND,8,5,PD,LE,20090712),AND,
   (1,1,BI,NE,1,1,BI,OR,
/*
//    DD DSN=&&C1,DISP=(OLD,PASS)
//    DD *
   1,1,BI,NE,1,1,BI))
/*
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Jul 10, 2009 4:17 am    Post subject:
Reply with quote

Hi,

why do you need this statement twice ?
Code:

   1,1,BI,NE,1,1,BI



Is it just to simplify coding
Code:
))
at the end of the selection ?

Does sort drop duplicate statements ?

Gerry
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 10, 2009 4:30 am    Post subject:
Reply with quote

The OP needs the following:

Code:

  (41,9,CH,EQ,C'123456DH6',OR,                                   
   41,9,CH,EQ,C'123456DJ2',OR,                                   
   41,9,CH,EQ,C'123456DK9',OR,                                   
   41,9,CH,EQ,C'123456DL7',OR,                                   
   41,9,CH,EQ,C'123456DM5'))


Adding the '(' for the first account number and the '))' for the last account number would be difficult, so instead we use NOPs for the first and last conditions so we can generate all of the account conditions the same way without worrying about the parens:

Code:

  (1,1,BI,NE,1,1,BI,OR,
   41,9,CH,EQ,C'123456DH6',OR,                                   
   41,9,CH,EQ,C'123456DJ2',OR,                                   
   41,9,CH,EQ,C'123456DK9',OR,                                   
   41,9,CH,EQ,C'123456DL7',OR,                                   
   41,9,CH,EQ,C'123456DM5',OR,
   1,1,BI,NE,1,1,BI))


The 1,1,BI,NE,1,1,BI conditions will never be true so they act as NOPs. This makes it easier to generate the INCLUDE statement from the list of accounts.

Quote:
Does sort drop duplicate statements ?


No, it doesn't drop duplicate conditions but these two duplicate conditions are NOPs so they don't have any effect on the output records selected.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Jul 10, 2009 4:42 am    Post subject:
Reply with quote

Thanks Frank


Gerry
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 10, 2009 4:44 am    Post subject:
Reply with quote

Just a "trick" I came up with a long time ago for this kind of thing. Comes in handy.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Sat Jul 11, 2009 2:29 am    Post subject: Reply to: Sort card input from file
Reply with quote

Frank,

I have no idea what is the use of -->1,1,BI,NE,1,1,BI

And my current JCL looks like below

Code:
//STEP10   EXEC PGM=SORT                                           
//*-----------------------------------------------------------------
//SORTIN   DD DSN=SHS.ND830.MTLY.G0246V00,DISP=SHR             
//SORTOUT  DD DSN=SSYG.WKLY.M071209,                             
//            DISP=(,CATLG,CATLG),                                 
//            DCB=*.SORTIN                                         
//SYSOUT   DD SYSOUT=*                                             
//SYSPRINT DD SYSOUT=*                                             
//SYSIN    DD *                                                     
  SORT FIELDS=COPY                                                 
  INCLUDE COND=((8,5,PD,GE,20090529,AND,8,5,PD,LE,20090712),AND,   
  (41,9,CH,EQ,C'123456DH6',OR,                                     
  41,9,CH,EQ,C'123456DJ2',OR,                                       
  41,9,CH,EQ,C'123456DK9',OR,                                       
  41,9,CH,EQ,C'123456DL7',OR,                                       
  41,9,CH,EQ,C'123456DM5',OR,                                       
  41,9,CH,EQ,C'123456DN3',OR,                                       
  41,9,CH,EQ,C'123456DP8'))



The input file is a GDG file. and the requirement here is to change only the sort card account number. Can you please advice me on 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: Sat Jul 11, 2009 2:50 am    Post subject:
Reply with quote

Quote:
I have no idea what is the use of -->1,1,BI,NE,1,1,BI


I explained that in an earlier post - it's a NOP (no operation) that allows us to easily generate the INCLUDE condition from a separate data set with the accounts as requested in your first post. You really don't have to understand it to use the job I provided.

Quote:
The input file is a GDG file. and the requirement here is to change only the sort card account number. Can you please advice me on this.


I thought I did.

In your first post you said:

Quote:
Is there any way that we can copy all account# from a file into this sort card?


That's what I showed you how to do. I don't know what else you are asking for.

Plug the file with the account#s into the SORTIN DD in step S1 (I assumed the account number file is FB and has the account numbers in positions 1-9 - if that's not the case, give me the actual RECFM, LRECL and positions).

Use the following for SORTIN of step S2

//SORTIN DD DSN=SHS.ND830.MTLY.G0246V00,DISP=SHR

Use the following for SORTOUT of step S2

//SORTOUT DD DSN=SSYG.WKLY.M071209,
// DISP=(,CATLG,CATLG),
// DCB=*.SORTIN

So the DFSORT/ICETOOL job would look like this:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  account number file (FB)
//SORTOUT DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
* 1,9 is the starting position and length of the account number
  INREC BUILD=(5:C'41,9,CH,EQ,C''',1,9,C''',OR,',80:X)
//S2    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN   DD DSN=SHS.ND830.MTLY.G0246V00,DISP=SHR             
//SORTOUT  DD DSN=SSYG.WKLY.M071209,                             
//            DISP=(,CATLG,CATLG),                                 
//            DCB=*.SORTIN
//SYSIN    DD    *
  OPTION COPY
  INCLUDE COND=((8,5,PD,GE,20090529,AND,8,5,PD,LE,20090712),AND,
   (1,1,BI,NE,1,1,BI,OR,
/*
//    DD DSN=&&C1,DISP=(OLD,PASS)
//    DD *
   1,1,BI,NE,1,1,BI))
/*
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Thu Jul 16, 2009 12:18 am    Post subject:
Reply with quote

Many thanks frank. You are the man icon_smile.gif

During the first run i got ABENDU0251. This is because i didnt ftp with FB. AFter that i changed to FB and the job is running fine.

The job runs 4-5hrs... icon_sad.gif i could see in the spool that the sort card looks good.

I would like to clarify one quick thing why do we give 80:X?
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 Jul 16, 2009 1:16 am    Post subject:
Reply with quote

We use 80:X to ensure the generated control statements are 80 bytes long (to match the length of the DD * statements). DFSORT control statements are usually 80 bytes long.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Thu Jul 16, 2009 2:09 am    Post subject:
Reply with quote

Got it! Thanks frank
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Fri Jul 17, 2009 3:01 am    Post subject:
Reply with quote

Frank,

I am planning to do this ftp step using macro.... While ftp'ing it's going as VB, ie., variable block!!!!

Code:
Sess0.FileTransferScheme = "Text Default"   
   Sess0.FileTransferHostOS = 1    
   Sess0.SendFile "u:\outlook\Acct.txt","'ssyg.user.test.ftp1'"


Is it possible to transfer using FB? I tried to change the transfer scheme. But it's of no use. Please help me here.

IF that's not possible then please let me know what should be changed for VB in the above code that you have mentioned?
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 17, 2009 3:37 am    Post subject:
Reply with quote

I don't know anything about transferring with FB or VB. Maybe somebody else can help.

Quote:
IF that's not possible then please let me know what should be changed for VB in the above code that you have mentioned?


Are you asking how to use a VB account number file for the S1 input instead of an FB account number file?
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Fri Jul 17, 2009 3:42 am    Post subject:
Reply with quote

I don't know anything about transferring with FB or VB. Maybe somebody else can help.
--- I tried our expert google and searched. Found nothing which matches for my requirement.

Are you asking how to use a VB account number file for the S1 input instead of an FB account number file?
Yes

This could be the alternate method for me if now as i am unable to ftp to FB using macro.
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 17, 2009 4:11 am    Post subject:
Reply with quote

To use a VB account number file, just replace the S1 step with this:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  account number file (VB)
//SORTOUT DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(5,5)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  OUTFIL VTOF,
   BUILD=(5:C'41,9,CH,EQ,C''',5,9,C''',OR,',80:X)
/*
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Sat Jul 18, 2009 1:02 am    Post subject:
Reply with quote

Thanks frank
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 High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 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 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


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