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

Need Formating an Input File


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

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Wed May 04, 2011 12:51 pm
Reply with quote

Hi All,

Could you please help me in formatting an input file like below,

I/P - Lrecl = 80, FB

Code:


----+----1----+----2----+----3----+----4----+----5----+----6----+----7----
213129999999991234567890123456719AKEY000019901052$1001ABCDE                 
999addafgd Michele gdhg jg jmg khgm99999923456789012345678   KEY000029900052
9999999asdasd994567890123456789018SKEY000049903052$1283ASAAS$1231GSHSA$9362JSSDS
999999999567asfasff890123456789011DSKEY000059902052$9312FDSFD$4321DXVDA       
123456 SAMPLECODE ashje ej
213123     adsf akdja akd kad asdaj
123123     asdwer ergtr hrht
212312 Program1
      *-------------
a2sfev     sdfsgf sfs sgdsg sff
312344     MICHELE 1nsj34h4jh3jh3j
212312 Program2
a2sfev     sdfsgf sfs sgdsg sff
312344     asdas wien qw9iwq33 93nnsjmhb3hb
adasds program3
223awd     nnsaffbmam j ma m amn
ad2445     adn b bj3b hw h
242453               Michele 123456577
121344       Michele 323242424
139329          MICHELE 09249jvj9u3j
adasds program-MICHELE
223awd     nnsaffbmam j ma m amn
ad2445     adn b bj3b hw h


Condition to format the file:
1) Skip the lines until we find the word " SAMPLECODE" starting from 7th character.
2) Search for the word "MICHELE" till end of the file where the 7th character on the line should be Space and should be the first word after 8th position.
3) In the input file the word MICHELE can have in caps or small letter.

The output file is of FB and LRECL = 80.

Here the output we require should populate the line having "MICHELE", when the 7th pos is Space and will be the first in the line after 8th position.

Prior to populating the line MICHELE, It should populate the line where 7th position is SPACE and the 8th position is not equal to SPACE.
And the formating needs to be done as per below sample code,

Code:


----+----1----+----2----+----3----+----4----+----5----+----6----+----7----
Program1
   MICHELE 1nsj34h4jh3jh3j
program3
   Michele 123456577
   Michele 323242424
   MICHELE 09249jvj9u3j
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed May 04, 2011 7:23 pm
Reply with quote

Ok.. but output is having Program1 AND program3? What is the logic for that?

What is the sort product you are using? if it is DFSORT, what is the PTF level?
Refer ibmmainframes.com/viewtopic.php?t=33389 For finding PTF
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Wed May 04, 2011 7:50 pm
Reply with quote

Hi Sambhahi,

Thanks for ur reply.

The output is having Program1 and program3

Logic:

Along with the line Michele, It should populate the prior line where the 7th character is Space and 8th character is not equal to Space.

As per my input the word Michele is present only under Program1 and program3. Hence both the lines are getiing populated.


I am using Z/OS DFSORT V1R12 and having ICE201I H ptf level.
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Wed May 04, 2011 8:32 pm
Reply with quote

Just to add, the word SAMPLECODE can have only once in the input file.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed May 04, 2011 9:06 pm
Reply with quote

Niki,

Use the following DFSORT JCL which will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT 
//SYSOUT   DD SYSOUT=*   
//SORTIN   DD DSN=Your input file,DISP=SHR                         
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(8,1,SS,NE,C' ,-'),PUSH=(81:8,8))
                                                                   
  OUTFIL INCLUDE=(7,2,CH,EQ,C' ',AND,8,72,SS,EQ,C'MICHELE'),       
  BUILD=(7:7,73,JFY=(SHIFT=LEFT),80:X),REMOVECC,                   
  SECTIONS=(81,8,HEADER3=(81,8))                                   
//*
Back to top
View user's profile Send private message
Niki

Active User


Joined: 20 Sep 2008
Posts: 106
Location: Bangalore

PostPosted: Thu May 05, 2011 12:14 pm
Reply with quote

Hi Kolusu,

Thanks for your help.
Back to top
View user's profile Send private message
Goyal

New User


Joined: 16 Mar 2011
Posts: 2
Location: India

PostPosted: Fri May 06, 2011 3:40 pm
Reply with quote

Can same results be derived from "PARSE" option in DFSORT icon_question.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri May 06, 2011 4:17 pm
Reply with quote

Goyal - why don't you try and see what the result is?
Back to top
View user's profile Send private message
Goyal

New User


Joined: 16 Mar 2011
Posts: 2
Location: India

PostPosted: Fri May 06, 2011 4:29 pm
Reply with quote

Hmmmm... icon_wink.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri May 06, 2011 9:27 pm
Reply with quote

Goyal wrote:
Can same results be derived from "PARSE" option in DFSORT icon_question.gif


Goyal,

I would love to see a PARSE solution for this requirement especially when you need the program name from a different record.

Can you enlighten us with your solution?
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top