IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need Sort Card - Build Using DFSORT \JCL


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
itjagadesh

New User


Joined: 05 Dec 2006
Posts: 89
Location: chennai

PostPosted: Tue May 15, 2012 3:49 am
Reply with quote

All,
could you please me to build ftp card using DFSORT or any JCL utilities?
Below is the requirement

INPUT FILE 1 = > LRECL - 30 , FB

INPUT FILE 2 = > LRECL - 80 , FB

OUTPUT FILE 3 = > LRECL - 80 , FB


INPUT FILE 1 = > contains ftp file name (.txt)

********************************* Top of Data **********************************
abc.txt******************************** Bottom of Data ********************************

INPUT FILE2 = > contains ftp card

Command ===> Scroll ===> CSR
********************************* Top of Data **********************************
FTPBOX (EXIT
USERID PASSWORD
LOCSITE FILETYPE=SEQ RECFM=FB CY PRI=100 SEC=50 LREC=185
get xxxxxx.txt +
'A01.B01.MF.FILE' (REPLACE
QUIT
******************************** Bottom of Data ********************************

OUTPUT FILE 3

Command ===> Scroll ===> CSR
********************************* Top of Data **********************************
FTPBOX (EXIT
USERID PASSWORD
LOCSITE FILETYPE=SEQ RECFM=FB CY PRI=100 SEC=50 LREC=185
get abc.txt +
'A01.B01.MF.FILE' (REPLACE
QUIT
******************************** Bottom of Data ********************************

Need to replace xxxxxx.txt(FILE2) to abc.txt (FILE1). (ie copy ftp file name inside FILE1 and replace
XXXXXX.txt ). Note - length of .txt file name inside FILE1 will vary (it may be 1 to 30 bytes)
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue May 15, 2012 4:15 am
Reply with quote

I believe you would be able to apply Kolusu's second discarded solution to your previous problem.

With File 1, create the "fiilename +" as a symbol with a constant value.

In the second sort step,

Code:
WHEN=(1,4,CH,EQ,C'GET "), OVERLAY=(5:symbolname)
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue May 15, 2012 2:22 pm
Reply with quote

This, then, is modified slightly from Kolusu's second solution to your previous problem.

It is "two step" solution but the first step is insignificant, just generating a SYMBOL for the SYMNAMES DD statement. The SYMBOL created has the value of your filename from the input file (first record only will be read) and the trailing "+". The filename can be up to 30 characters.

The second step reads the "model" ftp control cards, when it identifies "GET " it adds, starting from position five, the SYMBOL value which was generated.

If you want it with the "splice" solution that you prefer, you'll probably end up attempting it yourself.

Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
AAAAAA
//SORTOUT  DD DSN=&&S1,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN    DD *
  OPTION COPY,STOPAFT=1
  OUTFIL REMOVECC,NODETAIL,
         HEADER1=('GEN-FILENAME,C''',1,30,C'+''',80:X)
//*
//STEP0200 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=SHR
//SORTIN   DD *
TPBOX (EXIT
USERID PASSWORD
LOCSITE FILETYPE=SEQ RECFM=FB CY PRI=100 SEC=50 LREC=185
GET
'A01.B01.MF.FILE' (REPLACE
QUIT
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,4,CH,EQ,C'GET '),OVERLAY=(5:GEN-FILENAME))
//*


Produces:

Code:
TPBOX (EXIT                                             
USERID PASSWORD                                         
LOCSITE FILETYPE=SEQ RECFM=FB CY PRI=100 SEC=50 LREC=185
GET AAAAAA                        +                     
'A01.B01.MF.FILE' (REPLACE                               
QUIT                                                     
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Tue May 15, 2012 3:54 pm
Reply with quote

here is my try @ splice:

Code:
//STEP100  EXEC PGM=ICETOOL
//TOOLMSG  DD   SYSOUT=*
//DFSMSG   DD   SYSOUT=*
//IN1      DD   *
WHAT-EVER-FILE-NAME-LEN-30.TXT
//IN2      DD   *
FTPBOX (EXIT
USERID PASSWORD
LOCSITE FILETYPE=SEQ RECFM=FB CY PRI=100 SEC=50 LREC=185
GET <PLEASE-REPLACE-ME> +
'A01.B01.MF.FILE' (REPLACE
QUIT
//OUT      DD   SYSOUT=*
//T1       DD   DSN=&&T1,SPACE=(TRK,(5,5)),DISP=(MOD,PASS)
//TOOLIN   DD   *
  COPY   FROM(IN1) TO(T1)  USING(CTL1)
  COPY   FROM(IN2) TO(T1)  USING(CTL2)
  SPLICE FROM(T1)  TO(OUT) ON(81,2,ZD) WITHANY WITH(1,4) WITH(36,80)-
  USING(CTL3) KEEPNODUPS
//*
//CTL1CNTL DD   *
  OUTREC FIELDS=(5:1,30,35:C'+',81:C'04')
//CTL2CNTL DD   *
  OUTREC FIELDS=(1:1,80,81:SEQNUM,2,ZD)
//CTL3CNTL DD   *
  OUTFIL FNAMES=OUT,OUTREC=(1,80)
//*
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue May 15, 2012 10:40 pm
Reply with quote

Naish,

Please stop posting inefficient solutions! We don't need three passes over the data here. The symbol solution is a better choice then SPLICE here.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Tue May 15, 2012 10:42 pm
Reply with quote

Naish wrote:
here is my try @ splice:


Naish,

Is there a particular reason as to why you chose the SPLICE solution ? You need to mention that you are assuming that the GET line is ALWAYS the 4th line in the input.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed May 16, 2012 4:44 am
Reply with quote

I feel responsible for mentioning the SPLICE. I couldn't find the IRONY tags. TS/OP had previously favoured SPLICE over simpler solutions, so I was having a pop at the idea again. Sorry for causing confusion.
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Wed May 16, 2012 2:31 pm
Reply with quote

Apologies Frank and Kolusu.

Frank,

I am learning DFSORT and find it interesting & fun. I have been trying to use it particularly to avoid writing unneccessay COBOL programs (used a couple of times and successful). I must say that this product is awesome and now I know that you have invented it icon_smile.gif .

I feel good that there is/was some one to correct and guide me. I am sure we all will miss you Frank. Thanks and wish you the very best for your future.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed May 16, 2012 5:20 pm
Reply with quote

Naish,

I find it commendable that you are working so hard at learning DFSORT.

Your effort is more than most of the topic starters on this forum.

I don't think you realize the purpose of this forum however.

People post with issues and questions. The EXPERTS will then help with guidance and solutions.

A novice such as yourself posting uneducated guesses is very counter productive. The experts then have to correct your solutions while trying to provide the answer to the original post.

Please continue to try and solve the issues, but please do not complicate matters by posting incorrect and/or inefficient solutions.
Back to top
View user's profile Send private message
Naish

New User


Joined: 07 Dec 2006
Posts: 82
Location: UK

PostPosted: Wed May 16, 2012 5:26 pm
Reply with quote

Thanks. Well noted. Cheers.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu May 17, 2012 12:07 am
Reply with quote

Naish,

I applaud you for your initiative and I wasn't trying to discourage you.

I'd suggest you spend time experimenting with JOINKEYS rather than SPLICE. SPLICE is a bit old-fashioned these days (although it still has some specific uses).
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Thu May 17, 2012 12:48 am
Reply with quote

Frank, I have always had trouble understanding SPLICE and was very glad when JOINKEYS came along. It may be due to all the of SQL queries that I have written, but I find JOINKEYS to be more intuitive. icon_cool.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu May 17, 2012 1:32 am
Reply with quote

Yes, I agree that JOINKEYS was a good "replacement" for SPLICE.
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Thu May 17, 2012 7:45 pm
Reply with quote

Very off topic, but last night I was telling my daughter the story of the man who introduced me to the advanced functions of DFSORT.

You ask, "Why would a 17-year-old girl be interested in that kind of thing?" Funny story. We were talking about people going insane or "losing it" at work.

This guy had gone to the main floor of our office building to get some caffeine, not sure if coffee or cola. While waiting for the VERY old elevator, a lady came up and pushed the UP button again. (These were so old they didn't light up when pressed)

My poor co-worker started berating the woman for pressing the button again and making it so the old system reset the wait time on the car and now it would be even LONGER to get a car and now he was going to be late........

Then, after the woman kind of tried to play it off, he poured his drink over her head. Right there in the lobby. Then he took off running up the stairs. However, this was no shrinking violet of a lady and she went after him. She finally found him on the sixth floor and first building security, then the police, had to come and end the situation.

So...any time I'm going through the DFSORT manual, or trying to get a tricky process to work, I think of that guy, and wonder if THIS was the thing he was trying to do when he finally cracked.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu May 17, 2012 11:11 pm
Reply with quote

It WAS probably SPLICE that put him over the edge. icon_wink.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts Is this possible via sort (in one pass)? SYNCSORT 4
No new posts GDG generation name to GDG Base name ... DFSORT/ICETOOL 3
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts Date format correction using dfsort DFSORT/ICETOOL 3
Search our Forums:

Back to Top