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
 

 

Extracting month from input file

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

New User


Joined: 13 May 2005
Posts: 38

PostPosted: Sat Jan 27, 2007 2:53 am    Post subject: Extracting month from input file
Reply with quote

Hi,
I have two input files as given below :

Code:

File1:
------
01  03122004  David
02  03311994  Ram
03  03231997  George

File2 :
-------

Report   mon2007


I require an output file which will be same as that of second file except it will replace 'mon' by 3 char text format of month name where month
is determined from position 4-5 file1.

e.g. here if file1 contains 03 then in output file it will be

Code:

Report   Mar2007


if file1 contains 04 then in output file it will be

Code:

Report   Apr2007


Could you suggest any way to achive this rather than using COBOL
program.

Regards,
Amol
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 Jan 27, 2007 5:06 am    Post subject:
Reply with quote

Amol,

I don't understand what you want to do. You say

Quote:
here if file1 contains 03 then in output file it will be
Report Mar2007
if file1 contains 04 then in output file it will be
Report Apr2007


But in your example, file1 has 01, 02 and 03, so which one goes in the output file and why - Jan for 01, Feb for 02 or Mar for 03?

You need to clarify the exact "rules" for what you want to do.
Back to top
View user's profile Send private message
umed

New User


Joined: 13 May 2005
Posts: 38

PostPosted: Sat Jan 27, 2007 6:13 am    Post subject: Re: extracting month from input file
Reply with quote

Hi,

the input file is as given below :

01 03122004 David
02 03311994 Ram
03 03231997 George

where the dates are 03122004 , 03311994 , 03231997 in mmddyyyy
format where mm is fix which we need to use to determine the text
name of the month in output file.

so output will be

Report Mar2007.

I hope now the requirement is clear.

Regards,
Amol
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Jan 27, 2007 6:57 am    Post subject:
Reply with quote

Hi Amol,

Should the output be 2007 no matter what year is in the input?

What should happen if the input has
Code:
01  03122004  David
     02  03311994  Ram
     03  03231997  George
     04  04151992  James
     05  04232005  Donald 


What kind of process is going to use this input file and the new output file? I ask because i wonder if the original file plus the literal "2007" might work with no new file (if everything isd gong to be 2007)?
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 Jan 27, 2007 9:15 pm    Post subject:
Reply with quote

Amol,

So the dates in file1 always all have the same month?

What is the RECFM and LRECL of each input file?
Back to top
View user's profile Send private message
umed

New User


Joined: 13 May 2005
Posts: 38

PostPosted: Sun Jan 28, 2007 11:08 am    Post subject: Re: Extracting month from input file
Reply with quote

yes.. the month in every date would be always fix...
the record ength for first input file would be 250 and
second file has record length = 80.

Regards,
Amol
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: Sun Jan 28, 2007 10:29 pm    Post subject:
Reply with quote

Amol,

Here's a DFSORT job that will do what you asked for. I assumed mon in file2 was in positions 10-12.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file1 (FB/250)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
* Create DFSORT symbol from the first file1 record as follows:
* Month,'mon'
* where 'mon' is 'Jan' for '01', 'Feb' for '02', etc
  OPTION COPY,STOPAFT=1
  INREC BUILD=(C'Month,''',
    4,2,CHANGE=(3,
      C'01',C'Jan',C'02',C'Feb',C'03',C'Mar',C'04',C'Apr',
      C'05',C'May',C'06',C'Jun',C'07',C'Jul',C'08',C'Aug',
      C'09',C'Sep',C'10',C'Oct',C'11',C'Nov',C'12',C'Dec'),
    C'''',80:X)
//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file2 (FB/80)
//SORTOUT   DD  DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
* Use the Month symbol to overlay mon in the file2 record.
  INREC OVERLAY=(10:Month)
/*
Back to top
View user's profile Send private message
umed

New User


Joined: 13 May 2005
Posts: 38

PostPosted: Mon Jan 29, 2007 10:55 pm    Post subject: Re: Extracting month from input file
Reply with quote

Its working fine.

Thanks a lot for all your help.

Regards,
Amol
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 splitting of file using XMITIP abdulrafi TSO/ISPF 3 Mon Mar 27, 2017 3:01 pm
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 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


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