Thursday, 26 July 2018

How to Ignore a Comma in the String in JDE?

This Code gives an idea about the report to ignore the Comma in the String while reading the CSV file.



Listing of ER for Report: Report : HAVI Daily PB Load Staging File (R58D0001)


=======================================================================
     SECTION: Ignore Comma Inside the String [GROUP SECTION] (S4)
=======================================================================
     OBJECT:  SECTION
     EVENT:  Initialize Section
-----------------------------------------------------------------------
     OPT: Using Defaults
0001 //
0002 VA rpt_RCCT_PositionedSegment = VA rpt_58_mnSegmentNumber_MATH01
0003 VA rpt_RCCT_TempSegmentCount = "0"
0004 VA rpt_MATH01_LoopCount1 = "0"
0005 VA rpt_MATH01_LoopCount2 = "0"
0006 VA rpt_ANY_CommaDelimiter = ","
0007 VA rpt_ANY_QuoteDelimit = """
0008 VA rpt_TXLN_ReqString = ""
0009 VA rpt_TXLN_PositionedString50Len = ""

-----------------------------------------------------------------------
     EVENT:  Do Section
-----------------------------------------------------------------------
     OPT: Using Defaults
0001 //
0002 // Find the Segment of the String from the entire row
0003 //
0004 VA rpt_RCCT_TempSegmentCount = "0"
0005 VA rpt_ANY_PositionedCharacter = ""
0006 While VA rpt_MATH01_LoopCount1 is less than or equal to "1,500.00"
0007    //
0008    VA rpt_ANY_PositionedCharacter = substr([VA rpt_58_szFlatfileRecord_VAR1],[VA rpt_MATH01_LoopCount1],1)
0009    //
0010    If VA rpt_ANY_PositionedCharacter is equal to VA rpt_ANY_CommaDelimiter
0011       // Increase the segment number
0012       VA rpt_RCCT_TempSegmentCount = [VA rpt_RCCT_TempSegmentCount]+1
0013    End If
0014    //
0015    // Take the Entire String with Comma upto 50 length
0016    If VA rpt_RCCT_PositionedSegment is equal to VA rpt_RCCT_TempSegmentCount
0017       //
0018       VA rpt_MATH01_StartingPosition = [VA rpt_MATH01_LoopCount1]+2
0019       VA rpt_TXLN_PositionedString50Len = substr([VA rpt_58_szFlatfileRecord_VAR1],[VA rpt_MATH01_StartingPosition],50)
0020       //
0021       VA rpt_MATH01_LoopCount1 = "1501"
0022    End If
0023    //
0024    VA rpt_MATH01_LoopCount1 = [VA rpt_MATH01_LoopCount1]+1
0025 End While
0026 //
0027 //
0028 // Filter out the String variable lies between the Quotes, including the Comma
0029 VA rpt_RCCT_TempSegmentCount = "0"
0030 VA rpt_ANY_PositionedCharacter = ""
0031 While VA rpt_MATH01_LoopCount2 is less than or equal to "50.00"
0032    //
0033    VA rpt_ANY_PositionedCharacter = substr([VA rpt_TXLN_PositionedString50Len],[VA rpt_MATH01_LoopCount2],1)
0034    If VA rpt_ANY_PositionedCharacter is equal to VA rpt_ANY_QuoteDelimit
0035       VA rpt_TXLN_ReqString = substr([VA rpt_TXLN_PositionedString50Len],0,[VA rpt_MATH01_LoopCount2])
0036       VA rpt_58_mnSegmentNumber_MATH01 = ([VA rpt_58_mnSegmentNumber_MATH01]+[VA rpt_RCCT_TempSegmentCount])+1
0037       VA rpt_MATH01_LoopCount2 = "51"
0038    End If
0039    //
0040    If VA rpt_ANY_PositionedCharacter is equal to VA rpt_ANY_CommaDelimiter
0041       VA rpt_RCCT_TempSegmentCount = [VA rpt_RCCT_TempSegmentCount]+1
0042    End If
0043    //
0044    VA rpt_MATH01_LoopCount2 = [VA rpt_MATH01_LoopCount2]+1
0045 End While

Thursday July 26, 2018  03:57

No comments:

Post a Comment

Thanks for writing valuable comment.